Hi everyone,
I noticed today that the time (using built-in shader variable _Time.y) in my UI shader is not updating, unless I either put a camera in the scene, or have the Scene tab open in the Unity Editor (which I guess counts as a camera). The Scene only contains UI, so I never added a camera. I tried this in Unity 2018 and 2020. Is this is bug, or intended behaviour?
Thanks,
Matt
You still need a camera if you want the UI to render in build/game view though… If nothing is actually being rendered then the rendering system isn’t receiving calls to update GPU global values.
Um, no. I have a published game with multiple scenes that have no explicit camera (i.e. a GameObject with a Camera Component) in them, and everything works fine. Until I wanted to do some UI shader effects yesterday.
Do you mean additive scenes that don’t have a camera but just a main scene that has a camera? Because I wasn’t implying you couldn’t have multiple scenes loaded that don’t have a camera.
If your game is just purely using the UI system… well that’s intended behavior apparently if there are no cameras to trigger the update of those shader values.
So I’d probably just ensure you have an orthographic camera that your canvases use instead, completely avoiding the problem, otherwise have to figure out another workaround that works for your situation.
1 Like
Sorry, I meant ‘multiple scenes’ as in different scenes that are not loaded at the same time. So I have multiple occurrences of a single scene with only UI, and no camera. Like you are suggesting, adding a camera is a quick workaround for the problem, so I have done that for now.
And cheers for linking the original issue tracker bug. I searched for this for a bit, but could not find it. I would say that this shows that it is not intended behavior though. Just too hard to fix. Since Unity 5…
Thanks for the feedback!