Tip of the day entries for 2014

December 2014

 *  Tip #78 – Lock the mouse cursor to the screen 

There are some instances when you may need to lock the mouse cursor to the screen. For example rotating the camera where you would press down on the right mouse button then drag the mouse to rotate the camera. If you wish to hide the mouse cursor and lock it to the screen while dragging you can use Screen.lockCursor.


 *  Tip #77 – ToolTip Attribute for MonoBehaviour fields 

Ever wish you could have a tool tip appear when hovering your mouse over a control in the inspector? Well look no further then Unity’s ToolTip attribute that you can apply to your MonoBehaviour’s fields!

November 2014

 *  Tip #76 – Don’t Destroy On Scene Load 

Sometimes it is handy to keep a game object alive for as long as your game is running. In order to prevent your object from being destroyed when loading a new scene use GameObject.DontDestroyOnLoad and your game object will persist between scene changes.


 *  Tip #75 – Get default Arial font at runtime using code 

If you need to retrieve the default Arial font via code at run time you can do so using the Resources.GetBuiltInResource method.


 *  Tip #74 – Change text field properties with GUISettings 

If you need to stylize your gui you can use the GUISettings class to change, the cursor color, flash speed, the selection color for text fields, as well as double click behavior.

May 2014

 *  Tip #73 – GUI Matrix 

Did you know that the GUI class has a matrix property that you can use to rotate and scale your gui elements.

The sample behaviour that is provided below will scale and rotate a gui label in the center of the screen.