Hey everyone! I’ve run into a bit of an issue. There are some cases in my application where a static menu will be displayed for a period of time. Even though nothing changes on screen, Unity is still constantly rendering out the screen. What’s the best way to keep a static screen and stop rendering for a period of time? I’ve tried disabling a camera and calling .render in OnGUI whenever I need to update the screen, but in the times when I’m not calling .render on the camera the screen goes completely blank. I’ve also thought of creating a texture2d of the screen and drawing that in ongui when I do not need to render the camera, though this seems like a very obtuse solution to the problem. Any help on this would be much appreciated! Thank you!
try changing the Clear Flags in your camera component, maybe this helps.
and you can set Application.targetFrameRate but this will slow everything down.
I have messed with setting the targetframerate and vsync. I tried setting the clear flags but when the camera is disabled the screen still goes blank instead of keeping the last drawn image :/. Thanks for the suggestion though! I was sure that was going to do the trick!
//This just makes the screen flicker :(
void Awake()
{
cam.clearFlags = CameraClearFlags.Nothing;
cam.enabled = false;
}
void OnGUI()
{
if (_curTime + 1 > Time.time) return;
cam.Render();
_curTime = Time.time;
}
do you work with rendertextures? maybe this can do it