I was wondering if there were any way to show text over an object(at the objects location) in Editor mode only, done programmatically?
The solution I found to closest match this problem was in using the Handles.Label function. It seems to do the trick.
using UnityEditor;
public class EditorClassName : Editor
{
void OnSceneGUI ()
{
var _target = (Type)target;
Handles.Label(_target.transform.position, "lblText");
}
}
http://unity3d.com/support/documentation/ScriptReference/Handles.Label.html
You can use UnityEditor.Handles to draw a label at any position in the scene editor.
The code like this
UnityEditor.Handles.color = Color.cyan;
Vector3 leftPosition = new Vector3 (-3, 1, 1);
Vector3 rightPosition = new Vector3 (3, 1, 1);
UnityEditor.Handles.Label (leftPosition, "Left");
UnityEditor.Handles.Label (rightPosition, "Right");