- Home /
How to animate (every editor frame) debug rendering when editor paused?
I've found OnDrawGizmos() - is there any equivalent which is called every frame?
I've had a look here: http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.html
There is nothing obvious in the documentation and I'd rather not have to set up a coroutine or something strange to do this... I'm not even sure if that would work anyway due to the low quality of documentation in this area and the weird and wonderful implementation of coroutines.
(Also, Debug.Line seems to be dangling lines atm when I set the lifetime on them to anything. The value seems to not be respected... I'm fairly certain this used to work correctly given the nature of code I see using that function.)
EDIT: for the record a coroutine does not seem able to solve this... nothing seems to be drawn regardless of how I set one up
EDIT2: the lines don't respect real time, they respect game time, so pausing the game allows them to pile up.
Answer by frarees · Jan 11, 2014 at 01:33 PM
If you create a custom editor for your behavior you can use OnSceneGUI. However that callback is not going to be called every frame but every time an event has been caught on the scene view while your behavior's inspector is active (works the same way as OnGUI does). Use Repaint to send a Repaint event to OnGUI and OnSceneGUI. Call it either when you make do something on OnGUI and want to see the scene updated or you can even do it every editor update registering a method that uses Repaint on EditorApplication.update
i will have to try this out and let you know how i get on. thanks for the suggestion
whilst i have not followed your precise suggestion EditorApplication.update gives me what I need. :)