Unity3D Great Code Snippets
Why can’t you type these in for us?
I could totally type these in for you but I choose not to because I don’t want to and because there is inherent brain/learning value in typing them in yourself and I believe you will get more value out of this page if you type them yourself. I type them in again every time I use them. Start typing or find the answers somewhere else.
How to do something periodically
The easiest way to do this is with “InvokeRepeating”. The second easiest way is with a coroutine. But if you want to do it with code in the update method:
How to Drag an object with the mouse
How to quit your application
How to affect a bunch of GameObjects at once
How to do Collision Detection
How to add a menu item to Unity
Cycling through an array the easy way
This is how to set an object to a different texture every time you press the space bar.
Its elegant in its simplicity