Tuesday 24 September 2013

How to use enums to store keys for scripts in Unity3D

Everyone love strings. Especially those hard-code when you can find all references to this one which you're looking for...
How much I love reading such code and often fix it... This is almost the best thing after magic-classes with thousands of lines and no comments.

<Sarcasm off>

But lets back to the our topic...

What is "enum"? And why should I use it?

Enumerated type (in short enum) is a data type consisting of named constant values. (from Wikipedia).
For example
enum Days {Mon, Tue, Wed, Thu, Fri, Sat, Sun};

Monday 9 September 2013

JSON - how to convert variables it into text and vice versa (with Unity3D & PlayerPrefs)

Recently I used JSON a lot and I'd like to share some knowledge about it.
Here I'm using MiniJSON (link) because I prefer C# rather than JS (this one make me sick!).


So at beginning what JSON is?
JSON is a... string :) And it can have our arrays, dictionaries, variables and other crazy things. And this is all about it, but if you like reading you should go to Wikipedia and read all about it :P