Game Development Reference
In-Depth Information
OnDrawGizmos
Implement
OnDrawGizmos
if you want to draw gizmos that are also pickable and always
drawn. This allows you to quickly pick important objects in your scene. You can also use
OnDrawGizmos
to draw the line or different types of
Gizmos
, such as
Gizmos.DrawRay
,
Gizmos.DrawLine
,
Gizmos.DrawWireSphere
, and so on, which will make it easier for
you to debug.
OnDrawGizmos
will use a mouse posiion that is
relaive to the
Scene
view.
Example
var target : Transform;
// Draw the blue line from this object to the target
function OnDrawGizmos () {
if (target != null) {
Gizmos.color = Color.Blue;
Gizmos.DrawLine(transform.position, target.position);
}
}
Reference
The methods menioned earlier can be referenced from the following Unity Scriping
Reference:
http://unity3d.com/support/documentation/ScriptReference/
MonoBehaviour.Awake.html
http://unity3d.com/support/documentation/ScriptReference/
MonoBehaviour.Start.html
http://unity3d.com/support/documentation/ScriptReference/
MonoBehaviour.Update.html
http://unity3d.com/support/documentation/ScriptReference/
MonoBehaviour.FixedUpdate.html
http://unity3d.com/support/documentation/ScriptReference/
MonoBehaviour.LateUpdate.html