Access Immediate Mode from within Update Loop
I planned to use Shapes to draw nicer looking Debug Data for example to visualize RayCasts.
How Would I go about doing that elegantly I know I could store the data and then in OnPostRender draw it, but I think it would be very handy to just use like Like Debug.DrawLine() from within Update.
This is now possible in 3.0.0, but it is not recommended
immediate mode needs to know when to add and when to remove these draw calls, and it's very easy to mistakenly add calls, without the engine knowing when to remove them at the right time.
basically - if you add a draw command in Update(), that draw command will only be removed once the specified camera has rendered, but if the camera isn't rendering, you're now adding a draw command every frame, without removing it.
It might sound like this is hard to accidentally do, but consider being in the editor, and you add a command in Update(). Then let's say you switch to the scene view, so the game isn't rendering - you're now stacking draw calls every frame without removing them, because the camera hasn't consumed those events. this is both an issue with how Unity's cameras lack proper callbacks, and more of a code structure thing on the user end. I could make the system smarter, but that would mean users would have to start caching variables and keep track of objects, which is an overhead I don't want users to have to think about
I have also added a helper class to make it easier to draw Shapes from MonoBehaviours, that automatically pipes into the correct onPostRender callback, so you don't have to manage that