gizmos icon indicating copy to clipboard operation
gizmos copied to clipboard

[2018.4.23] Not working in Play Mode

Open jbltx opened this issue 4 years ago • 3 comments

Hello, Apparently, in my project, the rendering of gizmos works well only in the Editor when the Play Mode is not enabled. I can see the gizmos in SceneView and Game View.

I am using Unity 2018.4.23f1 and the legacy render pipeline (no Render Pipeline Asset). When debugging, I can see I go through all the drawing process, so I am not sure what is different in Play Mode. The Gizmos Draw methods are called into my OnRenderObject() method (ExecuteAlways attribute is used to see the result in the editor).

I thought it could come from the onPostRender event, but even without PostProcess activated in the scene, I am not able to see it.

Any ideas ? Thank you.

EDIT :

After more investigation, it seems the GizmosInstance.queuIndex is equal to 1 when it arrives at OnRendered(Camera cam). So only the dummy Gizmos is processed. But in the queue, there are all the submitted Gizmos through OnRenderObject()...

I will let you know if I find something.

jbltx avatar Jun 19 '20 19:06 jbltx

It seems to be a synchronization problem, what I can see is, all my scripts submit draw in the queue, then when the dummy gizmos (from GizmosInstance.Update() ) is submitted, it seems to be another frame, so the queueIndex is reset, and only the dummy is actually rendered. For now my workaround is to reset the queueIndex only at the end of OnRederered(Camera camera). Now it's working fine for PlayMode, but of course this won't work in SceneView/GameView in editing Mode. For now the most important is the PlayMode.

image

jbltx avatar Jun 20 '20 00:06 jbltx

Hm, the fix would likely be to do add a #if UNITY_EDITOR for this exact case since it can only ever happen in the editor. I did have issues like yours in the past, and I thought I fixed it but I guess not lol. If I have time I will fix it, otherwise a PR would be great for this since I'm pretty busy.

popcron avatar Jun 20 '20 21:06 popcron

Any news @popcron ? same issue

CycloneRing avatar Jun 26 '22 22:06 CycloneRing