- Home /
Accessing Unity 3.4 gizmos through code.
Hey guys,
As you all might know Unity 3.4 comes with new and improved Editor Gizmo stuff. This has some pretty nice features, that for instance in two clicks let you set up a nice colored label gizmo above your Game Object.
But how do you do this through code? I've looked through all the new documentation and can't find anything about this. Am I correct that it can't be done? That would render it useless for anything but prefabs..
What I want to be able to do is
var myNewGO : GameObject = new GameObject();
myNewGO.thisNewGizmoStuff.label.enabled;
myNewGo.thisnewGizmoStuff.label.color = Color.yellow;
The same as creating an empty Game Object in the editor, going through it's inspector, clicking the new gizmo tool and clicking the yellow label. Please tell me this is possible..?
Regards, Joshua.
I'd also like to know more about this. from what I've seen it's kind of useless other than being able to turn off and on certain built-ins like audio sources and lights :\
The label (gameobject's name with a colored background) gizmo seems pretty nice to me. But if you can only set it up manually it's useless.
Well.. since it seems not to be possible.. feature request!
If you have any votes left, I'd much appreciate one or two :)
Answer by DaveA · Jul 31, 2011 at 04:53 AM
I just replaced my gizmo code with the new API (which is to say, I deleted it). So you could do the reverse: don't assign it with the editor feature, and use the old fashioned DrawGizmo stuff to do it in code.
But there's no easy way to, through the Gizmo class API, easily draw a text above a gameObject, and it looks a LOT less nice. Seeing how they've implemented this stuff it seems ridiculous that it's inaccessible. Thanks for the answer though :)
Your answer
Follow this Question
Related Questions
Custom inspector draw Gizmos 0 Answers
How to hide Gizmos by script 4 Answers
Gizmo equivalent of Handles.DrawSolidArc? 0 Answers
Gizmos drawing units 1 Answer