Website may be up and down over next few months. I'm currently doing a complete overhaul of everything. Going back to simple individual .htm pages, new overall site theme, sanitizing and cleaning up html of all pages and blog posts, attempting to implement a new tooling and publishing system etc etc.

Did you know you can customize the look of the mouse cursor in your game by calling Cursor.SetCursor?

Currently rated 4.0 by 1 people

  • Currently 4.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

This is not so much a unity specific tip but more of a C# language tip. if you are trying to port or adapt your game code from one platform to another like for example from XNA over to unity implicit operators may come in handy for automatically casting types and making you code much more readable and easier to port.

Link to MSDN Documentation here

Often times we programmers can fall into bad programming habits and we can forget or overlook language and API features that would otherwise make our lives easier. :P

Be the first to rate this post

  • Currently .0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

I'm running out of tips from the unity docs so I will be posting small code snips that you can use

The first code snip is for object billboarding. Just drop the script onto the object and it will automatically face the camera.

Be the first to rate this post

  • Currently .0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

You can specify the RequireComponent attribute on a class that inherits from MonoBehavior and Unity will add the specified component if it is not already present when you add the script to the game object.

[RequireComponent(typeof(RigidBody))]
public class SomeBehaviorScript : MonoBehaviour
{
}

Be the first to rate this post

  • Currently .0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

If you are generating meshes procedurally via scripting you can optimize that mesh for drawing by using MeshUtility.Optimize.

Be the first to rate this post

  • Currently .0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

You can use editor scripts to specify additional DEFINE directives for conditional compilation by using the EditorUserBuildSettings.activeScriptCompilationDefines property.

Be the first to rate this post

  • Currently .0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

If you need your editor script to support drag and drop functionality you can use the methods provided in the DragAndDrop class.

Be the first to rate this post

  • Currently .0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

If you need to know when the unity editor is changing play mode states you can hook into the EditorApplication.playmodeStateChanged callback.

Be the first to rate this post

  • Currently .0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Using EditorApplication.isPlaying & EditorApplication.isPaused you can control when you want to run or pause your game in the unity editor using scripting.

Be the first to rate this post

  • Currently .0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Unity provides access to the users microphone via the Microphone class.

Be the first to rate this post

  • Currently .0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Created by: X

Just another personal website in this crazy online world

Name of author Dean Lunz (aka Created by: X)
Computer programming nerd, and tech geek.
About Me -- Resume