- Home /
Controlling OnDrawGizmo
I'm trying to selectively draw an icon in OnDrawGizmos based on the value of a public enum, so the user (me) can change the value and have it draw a different icon.
Is this possible, because right now I have a switch statement doing the conditional, and every time I change the enum value, it draws the icon for the current selection AND every previous selection, and never clears, even across restarts.
void OnDrawGizmos() { switch (someClassEnumVar) { case 1: Gizmo.DrawIcon("blah.png"); break; case 2: Gizmo.DrawIcon("moo.png"); break; } }
Would you be able to add some example code to your question? It might make it easier for me to answer.
Code formatting here just doesn't work. But what I am doing isn't rocket science, but I am prepared to accept that it won't work in the editor.
Is someClassEnumVar
static or member? If it is static then that's most likely the issue. I do not see why this would otherwise be an issue. Add Debug.Log(someClassEnumVar);
and monitor the log output. Perhaps the variable is not being set as you expected.
Answer by Talimar · Apr 16, 2012 at 10:35 AM
I had extra icon in the gizmo's icon drop down, hence the double display :/
Your answer
Follow this Question
Related Questions
Gizmos at RunTime 1 Answer
Select object by selecting gizmo or handle? 1 Answer
Make hidden gizmos invisible 0 Answers
Component on SceneView camera has wrong gameObject In OnDrawGizmos. 0 Answers
Gizmo disappeared when custom editor 0 Answers