draw handles in game view

Dear Unity users,
I want to draw handles like arrows in game preview. I used this code but failed to see anything when run the game:

using UnityEditor;

using UnityEngine;

using System.Collections;

public class ArrowCap : MonoBehaviour {

//float arrowSize  = 1.0f;
//public GameObject target;

void OnGUI () {
	Handles.color = Color.red;
	Handles.ArrowCap(0,transform.position,transform.rotation,100.0f);
	Handles.color = Color.green;
	Handles.ArrowCap(0, transform.position,transform.rotation,100.0f);    	
	Handles.color = Color.blue;
	Handles.ArrowCap(0,transform.position,transform.rotation,100.0f);
}

}

Handles are only drawn in the editor's scene view, and in practice are usually drawn by a "CustomEditor" inspector. See the Unity Script Reference for examples.

1 Answer

1

Handles belongs to UnityEditor namespace and cannot be used in builds. This should not compile when building.