Unity GameObjects only in Editor please

Say you have a project with objects you don’t want in your final build. With unity you can go about this is a whole bunch of different ways.
You can add a script that can do a bunch of things like destroy the objects if it’s not running in the editor, or you could just simply disable the object.
Or if you want an unsafe and impractical method you could delete the gameobjects build the player and then undo.

Why go to all that trouble when you can just add the EditorOnly tag this causes Unity to not include these tagged gameobjects in the built player.
Without requiring even a single line of code. Ok, it’s possible you’ve already added a specific tag to your special gameobjects, then you just create an empty gameobject and give it the EditorOnly tag and hang your objects as child objects under it.

EditorOnly

Arduino: kWh Monitoring

Inspired by a fellow ne2000-event goer http://juerd.nl/site.plp/kwh (dutch site) who made a kwh-meter-meter. I decided to also do something similar with my Arduino as it was just sitting idle in a box waiting for greatness…

To do such a project requires a light amount of electronics experience, although you can probably do it without. If you know how to solder and you can tell the difference between positive and negative connections then bob’s your uncle.

Before I could get started on this project I needed a few more electrical components like resistors, more flashy leds and what not. I ended up searching the web for a decent place to order the components (which turned out to be Reichelt.de) and ordered the IR Sensor for the project from a local electronics shop in Utrecht because reichelt.de didn’t have it. Three days after ordering all the bits and pieces a package arrived and I could start.

I soldered the TCRT5000 sensor to a piece of soldering board because I didn’t want to break any of its terminals fiddling with cables and such, plus it made for a better connection. Added the resistors and two leads for power to that piece of soldering board and then connected it up to the arduino read out the value and.. awesome it worked straight away.

After some tweaking of values I got a sensible reading from the Arduino for each cycle on my kWh meter. That was step one actually getting an event outside of the kwh-meter. Now the question was what to do with that.

In the example project that inspired me (juerd’s project) juerd had an OpenWRT router capturing values and storing them into an rrd file. As I dont have any OpenWRT or linux server I thought why not use Munin to monitor my Arduino output.

To accomplish this I used my Ethernet shield as a webserver to serve values to a custom made munin plugin (which was easy to make). That saved me a problem because I already had munin running on a server of mine.

In using munin I have a polling time of 5 minutes which is more than enough to see the amount of power going out, but it would mean that if something used an excessive amount of power in a time period of less than 5 minutes then I could potentially miss it. To fix this I added a variable that gets reset after each web request and holds the highest value: maxwatt. That allows me to see when short bursts occur in my power usage. But overall the 5min poll time is just fine.

Yes it’s fairly low-tech at the moment but hey come on.. it’s an arduino project. Project code can be found here

A Quick update that this project is still working..
It needed a slight adjustment because my provider hands out dynamic IP addresses, and the arduino lost track of its self after a while.
So I had to change the order of execution in the loop and also added some dyndns updating..
Here’s the latest day graph:

Hello 2013… Happy New Year Everyone!

2012 has been a great year with a cherry on top… just before new years on the 27th my wife gave birth to our brand new daughter who is doing very well. This last year has been good, I got a permanent contract at work and we moved into our own house back in feb, all in all it’s been a rather eventful year. Of course the last few weeks have all been baby filled, now with things settling down and gradually getting in to the rhythm of broken sleep and changing diapers there is time in between to do grown up stuff.

What grown up stuff is there to be done? you may wonder?
[Tech Talk]
Well I noticed a few things on my site that needed fixing so i’ve tended to that, you’ll now notice that all unity webplayers on the site should be working much better. Plus i’ve updated the theme template to the newest version. Not to forget updating wordpress which was well over due.

In the near future I’m playing with the idea to switch hosting as this is getting to be a little over the top for something not generating much in return. If your reading this now your welcome to donate if you like what I do here, or if you have any tips for me please comment.

I may offer some nice stuff to the Unity Community via the Asset Store once I’ve figured out what that could/should be. If you have any requests or ideas for what an experienced Unity Developer should make and you’d be willing to pay a nice sum for it let me know.
[/Tech Talk]

Other than all of that technical stuff, I’m looking forward to the remainder of 2013 and what it has to bring, as well as watching my daughter grow and build her character. I do hope everyone enjoys 2013 in good health and free of negative stuff, so.. for now I wish you all a happy new year!

Pro Tip: Don’t let the bed bugs bite and steer clear of smelly diapers.

_MG_5037

Project: MOBZ

For the past year (2011) I’ve been working at Movares on a simulator for the training of bridge & lock operators. Operators of what??? the people that control locks/sluices for boats and plus some bridges.
More info about MOBZ can be found here and here
I now know a lot about them. I built the interface and logic behind the simulator all of it was done in the Unity Engine. Check out this video to see what is all about (sorry the voice is in dutch can’t help you there).

Unity Video Remake: Webcam Textures

A while back I posted something about video capture in Unity with a sad plea for beta access to version 3.5 which is now finally in public beta, so I decided to do a new post.

Setting up a Webcam Texture in Unity

Now as you may have seen in the Script Reference (the only place to actually find something about a WebcamTexture) there is no Object like a RenderTexture for a WebCamTexture which makes it a tad more harder to work with (read: not as easy to drag and drop in to materials).

Quickest way to get this working is to drop the following script on an object.

Checkout this script in action Webcam Example

Keep in mind that this in not the best way for multiple objects unless they all have the same material with the script on one object.
You can only have one WebCamTexture per webcam!

By the way.. Once 3.5 goes fully public I’ll put up a working example to give you a starting point, and so you can see yourself (if you have a camera connected of course) so keep an eye on my site 😉

If you’d like more help or a better example please donate any amount you wish and i’ll get to it..

Once you’ve got the camera running it’s possible to do all kinds of things.. I Look forward to the future of Webcams in Unity all over the internets. 😉

Issues: Cannot use web cam, since the user has not authorized this!

In your attempt at getting the webcam running you may have come across the following error: (I did at least)

Cannot use web cam, since the user has not authorized this!
UnityEngine.WebCamTexture:Play()

You can squash this little one by changing your build platform to Standalone Mac/PC. Go to Build Settings -> Select “PC and Mac Standalone” then click that little button at the bottom left “Switch Platform”, this, I think is something new.

The whole reason for this is because you probably have the Web player platform setup by default. This requires the user to first give permission to use their webcam because of privacy reasons. If you want to do this then you need to request the users permission by using the following piece of code:

IEnumerator Start()
{
yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
if(Application.HasUserAuthorization(UserAuthorization.WebCam)) Debug.Log("Authorized");
}

Same goes for UserAuthorization.Microphone. When you use a standalone platform the authorization is no longer needed.

Issues: The type or namespace name `WebCamTexture’ could not be found.

Thanks to solehome for commenting on this one. The public beta 3.5 seems to have an error when using WebCamTextures in Flash builds.
If you choose to build on a flash platform the following errors occurs:

error CS0246: The type or namespace name `WebCamTexture’ could not be found.

Are you missing a using directive or an assembly reference?

Error building Player because scripts had compiler errors
Solution to this problem… euhm dont build flash?

[ad]

Gameplay: Starcraft II Wings of Liberty

Just finished the Wings Of Liberty campaign this weekend. Good story and I like the gameplay around it. It be cool to know a bit more behind the scenes and how on earth they created such a game, in terms of game logic and mechanics behind it. It must be one huge amount of variables and such from a programmers point of view. I do like the “Thanks To” part in the credits.. “Your Mother” 😛 some smart aleck put that in there. It’s really the only part I took the time to read, because it seems to genuinely come from the developers.
Anyway, I enjoyed playing it thats for sure.. So now I’ve also played a bit against the A.I. on “Medium”, I’m missing a Normal level.. Medium seems to be just a little bit on the easy side. Next game I’ll go for Hard, hoping I can still win.
Your thinking I could also just play online against someone.. well yes thats true I could get my ass whooped by some guy that only plays online all day and end up losing and getting all depressed about it… I like my #winning 🙂 Currently my strategy against A.I. is to teister it a bit and then come a long with a huge amount of a few types and just waste the **** out of them, most of the time it works too. It sure helps blocking the way in the beginning, otherwise I do lose.

By the way the visuals in some cutscenes are just amazing I’m stunned by the way they did the rain flowing over the metal. That is some really nice work! (even though it is the Havok engine and i’m all into Unity at the moment) I’m guessing thats a custom made shader of somekind, well it cant be default Havok stuff right?

Photography Assignment

Once upon a time a few years back, I did a 10 week photography minor at Uni, These pictures were part of an assignment, they are a few of the best images I took during that course. Including the photos I took with a Pinhole camera.. I do miss doing that.. it was fun and gave unexpected results.. and it was real photography at the core 🙂

I mostly enjoyed spending time actually going out and standing in one place for 10 to 15 minutes to get enough exposure, plus it was a major kick to see the actual result after developing the photo, also sometimes a major dissappointment… I remember standing outside in the cold for around 20 minutes with my paint can duct-taped to a streetlight.. only to find out when developing that i had nothing but extremely dark patches…. so be warned 😉 Continue reading “Photography Assignment”

Unity GLSL Shaders

Hello Again,

In an earlier post of mine about WebGL I describe a few methods to enable WebGL on a Mac (Safari) the reason I did this was to view a few interesting shaders.. (is now ShaderToy.com) Now comes the cool part..
I actually got those same GLSL shaders I wanted to view running in Unity (yes for me that is a big thing).. Check out a few of these screenshots I took… It wont be long now and I may even integrate them into Image Effects on Cameras.. Continue reading “Unity GLSL Shaders”

Unity Cornell Box

For anyone interested in the Cornell Box and rendering it this is my attempt at it in Unity…
First of all I acquired the geometry for the cornell box from the site in 3DS Max exported it as a FBX file (available below) then opened up Unity3D. Using a the jpeg available from the site. Continue reading “Unity Cornell Box”