OnDrawGizmo when object is inactive ? (Editor)

is it possible to see OnDrawGizmo on inactive game objects ?
in default, it only works on active or selected gameobjects.

Heyo,

Alright, so I did some research. Here’s what it’s looking like. So, that OnDrawGizmo function is part of the Monobehaviour script that is on the object, right? That means when the game object is not active, the script isn’t active, which also means this function won’t be executing. So that’s a problem. You’d need a way to get your gizmos / handles to be drawn some other way I think.


As for those other ways, I did some more research. You are able to bind events to Unity’s SceneView.onSceneGUIDelegate (the link here may may be useful or not, dunno) which will draw things to the scene window without relying on a Monobehaviour. This might work, but it won’t necessarily be drawing the gizmos that you had all made and planned in your OnDrawGizmos function. You’d have to make another thing to draw handles and such to the scene view. Another potentially problematic issue with this is that if you needed these Gizmos drawn for a specific object, I’m not quite sure how you’d give the function you bind to the above delegate this object (so that it can use it and such).


I also looked into using an Editor script based off a Monobehaviour script to see if I could manage to get something easy working there using the OnSceneGUI function, but that didn’t seem to work. It was relying on the Monobehavior being active again.


CONCLUSION

So, I didn’t quite manage to find something that would simply make your gizmos show up on a disabled object sadly. I wish it were easy but yeah. I figured I’d report my findings to you in case you may have been looking into this stuff. It is POSSIBLE that you could use the onSceneGUIDelegate and use some other editor script that is initialized using InitializeOnLoad. You could then bind a gizmo / handle drawing function to the delegate and then you would have to send all objects that you may want drawn to this script to hold on to and draw in the background. This would be tedious and a bit of work though… HOPEFULLY someone else can post a nice easy solution to this if one exists, but as far as I know, you can’t nicely do what you’re wanting.