For mobile games in Unity, if you have menus which overlay your main scene Unity is rendering the whole scene like normal while your users are interacting with the menu, even if you’ve “paused” (Time.timeScale = 0) the game, the camera is still rendering the scene in the background.
This is a “bad thing” as your app or game is sucking your users battery while it needlessly runs all the rendering code.
Whats the solution?
The idea is to switch off the camera while the menus are active.
I thought it’d be a great idea to just temporarily capture the screen into a Raw Image and use it as a background in the UI allowing me to disable the camera, so the solution is to grab a frame from the camera store it and use it as the background for the UI. I’ve also added in a blur effect to the background.


I have a couple of player customisation menus and a settings menu and I wanted to try this technique out with.
I couldn’t find anyone doing this and spent a while trying to work out a way to do it. I used the blur shader from here: https://catlikecoding.com/unity/tutorials/advanced-rendering/bloom/ its old but gold.
You need to setup a RawImage as a background image in the UI, set it to stretch fit (yes if you change orientation it gets stretched!), then set the main camera to render to a render texture and set that as the texture for the raw image.
The raw image has a shader and material similar to the one on cat like coding, it modifies the render texture with a couple of passes and then blits back the modifications to the render texture. Then while the user is in the menu I can disable the camera component, which means the menu looks better and the battery life is happy. Save the planet one charge at a time!


