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:
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 place this script on the object you wish to display the Arrow Caps.
using UnityEngine;
[ExecuteInEditMode] public class DummyArrowCap : MonoBehaviour { public void Start( ) { Debug.Log( "I have ArrowCap Handles attached to this transform!" ); } }