That works great, except when I come close to a big object, my UI dissapears.
When I clean occlusion, that works well.
Problem is my UICanvas and my image are not tagged as “static”. Also I tried to bake when my UI canvas was disabled and I still have the same problem.
My world space canvas which is not static can go inside the landscape and disappear. If I disable occlusion culling on the camera the UI appears again but this is not an option for in-game. I have a material with a shader to ZTest always on the UI elements which works a majority of the time except for this occlusion issue.
I cannot find anything to disable occlusion culling for a dynamic object.
Typically for 3D I would expand the bounds but I cannot find an exposed way to do this for UI so I am making Unity give the object a larger bounds.
Basically I add an object within my UI that is very small and completely transparent but still rendered. Then I take this element and ensure it is within the viewport of the camera by making it very close. Obviously this will result in some overdraw so ensure that the fillrate is low by making the object small.
This is far from ideal but a solution for now so I can continue on with my game.
So I wasn’t the only one to have this issue …
To fix my problem I also used a little hack. I created a second camera with layer “UI”. So it can see through other elements.
In my main camera I excluded the UI layer. That works fine.