controlID | The control ID for the handle. |
position | The world-space position of the handle's start point. |
rotation | The rotation of the handle. |
size | The size of the handle in world-space units. |
Draw an arrow like those used by the move tool.
Note: Use HandleUtility.GetHandleSize where you might want to have constant screen-sized handles.
Arrow Cap in the Scene View.
To use this example, save this script in your Assets/Editor folder:
#pragma strict @CustomEditor(DummyArrowCap) public class ArrowCapEditor extends Editor { public var arrowSize: float = 1; function OnSceneGUI() { var t: DummyArrowCap = target as DummyArrowCap; Handles.color = Handles.xAxisColor; Handles.ArrowCap(0, t.transform.position, t.transform.rotation * Quaternion.Euler(0, 90, 0), arrowSize); Handles.color = Handles.yAxisColor; Handles.ArrowCap(0, t.transform.position, t.transform.rotation * Quaternion.Euler(-90, 0, 0), arrowSize); Handles.color = Handles.zAxisColor; Handles.ArrowCap(0, t.transform.position, t.transform.rotation, arrowSize); } }
using UnityEngine; using UnityEditor;
[CustomEditor( typeof( DummyArrowCap ) )] public class ArrowCapEditor : Editor { public float arrowSize = 1;
void OnSceneGUI( ) { DummyArrowCap t = target as DummyArrowCap;
Handles.color = Handles.xAxisColor; Handles.ArrowCap( 0, t.transform.position, t.transform.rotation * Quaternion.Euler( 0, 90, 0 ), arrowSize );
Handles.color = Handles.yAxisColor; Handles.ArrowCap( 0, t.transform.position, t.transform.rotation * Quaternion.Euler( -90, 0, 0 ), arrowSize );
Handles.color = Handles.zAxisColor; Handles.ArrowCap( 0, t.transform.position, t.transform.rotation, arrowSize ); } }
...and attach this script to the object you wish to display the Arrow Caps on.
#pragma strict @ExecuteInEditMode public class DummyArrowCap extends MonoBehaviour { public function Start() { Debug.Log("I have ArrowCap Handles attached to this transform!"); } }
using UnityEngine;
[ExecuteInEditMode] public class DummyArrowCap : MonoBehaviour { public void Start( ) { Debug.Log( "I have ArrowCap Handles attached to this transform!" ); } }