Hi,
In Unity there are two classes Gizmos and Handles that can both do some drawing in scene view. Why is it so that Gizmos.* can only be used in OnDrawGizmos? Why are there restrictions in place saying what I must draw in OnSceneGUI and in OnDrawGizmos?
In particular I want to draw “wire sphere” and “disk” to visualize something complex in scene view when it’s selected, but I can’t do it in OnGrawGizmos (there’s no disk drawing) neither in OnSceneGUI (there’s no wire sphere).
I’m answering this in case someone stumbles to this and is exceptionally confused on why this is:
Because Gizmos are inherited from Monobehavior, and OnSceneGUI scripts inherit from Editor.
This is required first and foremost to make the editor and the game separate entities, along with the performance benefits.
You can have a gizmo drawing script which you call with the custom inspector to toggle its gizmos on and off with a public bool, however.
Don’t forget that Handles underneath OnSceneGui does have some draw functions aswell.