Unity Post Process Mayhem

Are you sick and tired of forgetting to copy that data file to the build directory after each and every standalone build in unity? Sure you could incorporate it into the project but you don’t want that, you just wish that PostProcessBuildPlayer script would work on windows. As of Unity 3.5.2 life just got better…

A long awaited function in Unity was a working post process build player script for standalone players on windows as it was already working on mac’s. As seen in the latest Release Notes and stated in the BuildPipeline a few things have changed.. Apparently the PostProscessBuildplayer script is not supported on windows, which is a bummer for windows users on the other hand it’s easily solved with a new and improved UnityEditor.Callbacks which is both usable on Windows and Mac, So here goes…

P.S. No this is not a custom build window script, it actually triggers from the existing Unity BuildWindow.

NB: -10 is a higher priority than 100, the default priority is 1
NB2: This is an Editor Script not something for a gameobject (you should know this)

You can use the method to do all kinds of things on your computer after a build is complete just a couple ideas:

  • After a large build send an email with a link to the file saying the build is complete.
  • Play a sound notifiying you build is complete
  • Run a test on your build
  • And lots more…

Anyway now you have the tools go make 🙂

Unity Editor Macros

A while back the guys at unity released a version of their editor with macros enabled (by accident) in the current version is has been removed/disabled. (this because it’s something they use for testing and not meant for production environments)
But with recent endeavours I found it’s possible to enable it in the editor making debugging stuff within the editor more entertaining, plus it adds a new window to the editor making your editor more of an editor.
Please note this is not documented by unity and probably not supported either.

Simple script:

How to use:
Place this script in an Editor directory in your Assets and then:
Go to Window->Macros and tadaa.. you have a new editor window that can record all your editor actions and execute new ones.
May this help you on your endeavors of making cool new stuff for unity

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).

[youtube=http://www.youtube.com/watch?v=p4RK3Xmu4dI&w=500&h=400&rel=0]

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]

Unity Video Capture

There once was a Unity Engine roadmap without any means of capturing video or audio, conclusion: If you wanna do it right do it yourself or hope unity implements it themselves.. w00t v3.5 🙂 well anyway before 3.5 my little plugin named Video Grabber was born…

Built on the basis of OpenFrameworks (being one of the frameworks to handle video for windows & mac at the same time) and also allowing for alot more fun.
I successfully built this library as a plugin into Unity. In doing this I can now capture pixels from the camera and transfer them to a texture in a scene. I even added in some face recognition to the whole shebang…
It works quite well with a slight delay of a few milliseconds, but who really cares about that. BTW oF is doing some really cool stuff 🙂

So what happens when you’ve almost finished a functioning Video Grabber (except for a couple of problems when stopping the plugin) you find out that Unity is going to implement it themselves.. of course.. Unity wouldn’t be Unity if they didn’t.. you need video we’ll put it right in there, how about some audio as well then.. whut? you want AI pathfinding… sure no problem. While we’re at it we’ll mix in a little UI update and some extra goodies… What can we expect in version 4.0? A “Generate AAA Game Concept” buttonâ„¢ all ready and waiting?

One thing’s for sure.. I’ve temporarily stopped working on my Video plugin with high expectations of Unity 3.5 coming.. 🙂
[insert plea to beta group owner for a membership here with a cherry on top]

If your interested in looking at what I’ve currently got for video grabbing add a comment below make sure to add your email address in the proper field (which will stay private) i’ll add you to the private repo and we maybe could start an open source project for the community. 🙂

[ad]

Updated Site Theme

Ok first of all, it was definitely needed wasn’t it.. the old Twenty Ten template has been and gone… plus it dont look that swiffy anymore..

So yes i’ve updated the theme and I think it’s a definite improvement! Saves me a huge hassle making one and this one is customizable enough for me… and i’ve always said “I’ll update my site sometime soon” with slight “Yeah Right” feeling.. Anyway it is done..

I still need to figure out what im going to do with some content areas.. I may also just disable them as they don’t really add very much to the whole shebang just yet… other solution is to start brainstorming a bunch and come up with some really superb content.. but theres that “Yeah Right” again…

So for now I hope you like this new layout if not let me know.. I’m bursting to make your life easier 😉 YEAH RIGHT!

 

Video Animations

As I’m a fanatic video and audio person I like to experiment with various applications and tools. I like to endeavour into unknown territory, learn a bit and move on to new horizons ever expanding and not always getting extremely deep into one thing. Below are a few animations I once made. I may add to some of these with what I now know sometime in the near future. First I want to capture some interesting video fragments to add stuff to.

 

Continue reading “Video Animations”