Some people suspect that if they know too much about a subject, they won’t be able to enjoy it anymore. Let’s call it the Critic’s Curse: because they have analysed so much, they will find fault in everything and enjoy nothing.
Of course, there are the people that argue that this also applies to game design, as outlined by Josh Foreman in a blog post over at Gamasutra:
GUIs are not exactly easy to program in Unity 3D, since there is only one method available (OnGUI()) that obviously has to take up everything.
This becomes a problem as soon you try to create different menu screens that have to be switched out. One way to do it would probably be to use different scenes (which would be cumbersome); another way to use a switch, which would be just as cumbersome.
Since I’m currently cleaning up my code to hand it in with my project, I figured I could write some of the stuff down I learned during my work on our game.
All of it applies, of course, to C#, and was used in Unity 3D.
Checking for a type
Using the is keyword, you can easily check whether a certain object is of a desired type. Also, you should be aware of the as keyword, that allows you to cast an object as something else (given that this is possible).
Another script that is the result of the ProXedural project at the ZHdK. It produces a somewhat randomly generated level of the size of a collider that is placed over a terrain in Unity 3D.
By using a somewhat mixed approach of completely random raycast placing and placing objects using an array, the script can ensure that the different kinds of objects are distributed all over the terrain.
Again, the script may be oddly specific at times, so you might have to adapt it to your needs if you intend to reuse it.
A simple walker script for Unity 3D in C# that tries to avoid obstacles. It has been used in the ProXedural project at art school, and it made the cows walk towards one of the players. To be honest, it does not really deserve the I in AI. But then again, no one expects cows to be very clever.
Maybe someone can use it as a base to produce something better (oh well, who am I kidding, this has already been done).