- Home /
OnGUI elements in editor scene view
Hi, I'm building a level editor and want to show some interface elements within the scene view while not in runtime. I know how you can get them in the Game view and I know how to get them in the inspector, I just can't seem to find how to get them in the actual Scene View. I've tried using a callback function to call OnGUI, but that's mainly preserved for Update and returns a ton of reference exceptions.
Anyone know how to accomplish this?
And if I use OnSceneGUI it will kind of draw it in worldspace or something. Very weird to say the least.
Answer by Jamora · Mar 01, 2014 at 11:47 AM
This seems like a perfect opportunity to use Gizmos. You can't draw labels, but luckily they're not the only way to debug.
I'm under the impression that Gizmos were in Worldspace most of the time and I'm not necessarily trying to debug anything. I'm trying to make an GUI the same manner I would in game, intractable, but ins$$anonymous$$d I want it in the Scene View.
If you're trying to make an actual GUI with GUI.Buttons and GUI.Labels, I'm gong to say it's possible, but not worth the trouble. I think unity specifically changed it at one point so that the scene view would not show any GUI elements. Scenes shouldn't have anything to do with GUIs, anyway.
Regardless, you might be able to pull this off with NGUI, or a similar gui system, which lives in the scene.
Seems to me EditorWindows or $$anonymous$$enuItems with key shortcuts are a better choice.
Thanks for your thoughts, though this is an interface which would be better used in the scene view.