So I have a component with a custom editor UI on it, which includes an OnSceneGUI, to draw some extra handles on the object. This all works great, when I’m working with actual instanced objects using this component.
However, when I have the component attached to a prefab, and select that prefab in the Project window, OnSceneGUI still runs. So, it still displays those extra handles in the scene view, even though the object the handles are supposed to be attached to isn’t actually in the scene at all.
Is there a way to check in OnSceneGUI if the currently selected object is a prefab, so I can not display the handles in that case?
This has gotten a lot of views, but no answers, so I’m guessing that the answer is no, there is no way to tell if it’s a prefab or not.
Might be a good suggestions for the next update, that either OnSceneGUI isn’t run on prefabs at all (probably the best solution, since I can’t think of any time you would want to display a GUI in the Scene window for a prefab), or that the function is given some way to know if the selected object is a prefab or not.