Skip to content

Instantly share code, notes, and snippets.

@kyleweiner
Created November 11, 2012 01:41
Show Gist options
  • Save kyleweiner/4053316 to your computer and use it in GitHub Desktop.
Save kyleweiner/4053316 to your computer and use it in GitHub Desktop.
Unity: Draws an icon on a game object in Unity 3D's Scene View.
#pragma strict
/***********************************************************************
* Notes
***********************************************************************/
/*
* Attach this script to an empty game object to give it an icon in the
* Scene View. The icon file, as set by the "name" variable, should reside
* in the project's "Assets/Gizmos" folder. See this page for more details:
* http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnDrawGizmos.html
*/
var filename : String; // e.g. "Spawn Point Gizmo.tif"
var allowScaling : boolean = true;
function OnDrawGizmos() {
Gizmos.DrawIcon(transform.position, filename, allowScaling);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment