camera pause / lag problem

I have a second camera (for rendering a gun scope view)
but when I turn this on and off, there is a huge pause… up to several seconds on some machines…

is there a way to get rid of the pause…
I only want that camera to render when in zoom scope view… not all the time.

camScopeObj.camera.enabled = true;

or…
camScopeObj.camera.cullingMask = ~0;

help appreciated, thx

1 Like

anyone ?

I’ve not tried this but perhaps you could try using a layer and culling mask option instead of setting the camera on and off.

good idea, thanks.

I tried it, but its exactly the same…
IT seems to be something like unity is doing garbage collection or something similar and deleting all the camera’s resources when its not rendering anything.
(same result wether camera renderer is disabled, or if the culling mask is set to 0)

If you repeatedly change camaers quickly… multiple times… then its an instant change and there is no lag ever… however if you wait just a few seconds, and then switch cameras, there is a large lag.

does anyone have any idea how to stop this from happenning ?
thanks

some more interesting info…

This pause does not show up on the profiler.
It also pauses the profiler.

its like a case of missing time…

any ideas ?

replying to myself again… first sign of madness.

anyway…removed the second camera, and tried a 2D overlay for scope view, and jist change the Field of View of the camera to get the zoom effect…

surprise surprise… the big pause/lag is still there, even when using only one camera. !! :shock:

anyone know if this is a known issue, or any fixes to it ?

have run out of ideas of how to make scope view work.

ok another update…

Zooming the FOV slowly (instead of instantly) just spreads the lag out into several smaller lags.

But now at least it shows up in the profiler… as a culling problem.

I guess Unity doesnt like you changing the view frustrum. ?

55% of frame time in Culling->Terrain.CullAllTerrains->Terrain.Heightmap.Rendertep3

and 41% in IslandWater.OnWillRenderObject->Camera.Render->Culling
even though there is no water (or water shader) in the scene!

any ideas ? please… help ? agk.

This sounds strange - camera shouldn’t be so sensitive to such changes. Could you make small project which reproduces the issue and submit as a bug and post the case number?

I have the same problem, when switching to my scope cam in my shooter, there is a huge lag and I have no idea how to fix it!