- Home /
Stop rendering scene when GUI window is active.
Hello guys, need your help.
We are developing 2d game with 2 cameras in main scene. First camera (main) is for game objects, user interaction (like scrolling) etc, the second is for gui elements.
When user clicks button large and beautiful window appears. But we have a small problem here: whole scene still up and rendering, so this affects performance badly.
All we need is to stop rendering scene in main camera, but with last rendered frame remaining on screen, so our large and beautiful window won't feel lonely.
I have tried this method to solve this issue:
private int MainCameraCullingMask {
get;
set;
}
private CameraClearFlags MainCameraClearFlags {
get;
set;
}
...
MainCameraCullingMask = MainCamera.cullingMask;
MainCameraClearFlags = MainCamera.clearFlags;
MainCamera.clearFlags = CameraClearFlags.Nothing;
MainCamera.cullingMask = 0;
but with no luck, screen under the window becomes pitch black.
Can anybody help?
P.S. Making texture from last rendered frame and drawing it under the window sounds like pretty ugly practice. But if I have no options...
Answer by mattssonon · Aug 22, 2013 at 01:21 PM
Have you looked at the answer here: http://answers.unity3d.com/questions/147988/how-to-pause-the-main-camera-.html ?
Yep, I used the method described there, but it just doesn't work and I have no clue why.
Answer by Elecman · Mar 02, 2014 at 05:31 AM
CameraClearFlags.Nothing doesn't work on some mobile devices. For a proper solution, please vote for this: http://feedback.unity3d.com/suggestions/better-support-for-guionly-appl http://feedback.unity3d.com/suggestions/realtime-input-framerate-indepe