Friday 28 August 2015

Unity 5 WebGL vs Web Player. 12 Pros and Cons.


Unity Web Player is up to this date still the most popular way of making your game arrive to your audience. Very often you will want to put your game Online on your Landing Page even if your game is for mobile or desktop. The Web Player is then one of your options, but not the only one. WebGL new builds are the new alternative for publishing your games in your browser. I have to admit it's very impressive and promising... But is it really superior? I tried both and I can tell you my insights... hope it will help :)

If you think one of both is absolutely better than the other, then you are absolutely wrong :)

Web Player

The good old Web Player has been with us for many years. It started fighting flash for it's piece of cake... they said flash was dead (the same with the Web Player) but it is still quite commonly used despite the fact that many platforms stop to support it (the same with the Web Player).

A bad penny always turns up... This will not be the end of the Web Player :)

Friday 7 August 2015

Unity 4.6 - Simple Tutorial, Unity Event Delegates Exposed in Editor Example


Exposing UnityEvent in the editor is much simpler than it looks! You will have the same fancy delegate event calls that the UI elements such as Buttons are having to drag and drop behaviour calls easily between your scripts! Unity Events were one of the fantastic additions to Unity 4.6, way before version 5 came to life. To my surprise, they passed very unnoticed! It's even hard to find an example that describe how to use them, not even on the official documentation!!! This is so sad that I decided to write an example myself  and try to spread the use of this fantastic feature!

UnityEvent in a custom script. Very easy and very useful! :)

So let's imagine that you have are creating a "system" for your Unity game. This "system" can be anything, from something simple like a simple timer to complicated path finding system or full featured combat engine.You want your system to be as independent as possible, that's why when important things happen you use delegates. However, delegates imply that the script that is listening for this events knows about your system at code level.

Sometimes you will want that the listener classes don't know about the notifying system neither. In the exact same way that Unity UI or NGUI work, the "links" between the classes are defined in the editor via drag and drop by the developer. Sometimes a game designer or an artist without programming skills will be doing it and then it's one of the best options.

Stop talking and let's see how it works. In this example we will have 2 simple classes.