Challenging and casual problem solving puzzle game that makes you want to play "just one more map"

Post tutorial Report RSS Simple Battery-life and Energy Optimization for Mobile Games using Unity

Simple way for mobile games using Unity to save battery power.

Posted by on - Basic Other

Simple Battery-life and Energy Optimization for Mobile Games using Unity


Are you creating a new mobile game using the Unity engine and your mobile-phone is getting really hot after playing for a while? Have your players complained about the app is draining their batteries?

If you answer yes on one of the above questions or you are just interested in a simple way to optimize battery-life for Unity games, then this guide is for you.

Frame rate is the key

I had the same problem when I first started developing Labyrinth Robots. My friends that tested the first alpha version of the app told me "the app was sucking the life out of their mobile". So I understood that it was very important to do something about it.

The simplest and most effective thing I found was clamping the frame rate. I put the maximum frame rate to 60 fps (frames per second), which was enough to have smooth movement and animations while still not turning the phone into a heater. Then turning the fps down during parts where the game didn't need all the fps.

Since Labyrinth Robots is a casual problem solving game it contains parts where the screen will remain idle for a very long time while the player is thinking. This is perfect time to optimize and lower the fps to 15 fps during these times. There is simple no reason to let the game render a lot of frames if these frames will be the same anyway. This trick may not work for all game types, but it is very handy for casual games.

How to set frame rate in Unity

First of you need to change a setting found in Edit->Project Settings->Quality. Under the Other section you will find V sync Count. (Unity doc: Docs.unity3d.com)

V sync Count must be turned off.

vsync turned off


Then you can set the maximum frame rate in code using Application.targetFrameRate. For example:

public class MyGameManagerClass : MonoBehaviour {
    void Awake() {
        Application.targetFrameRate = 60;
    }
}

Using this technique I could drastically lower the battery consumption of Labyrinth Robots. I recommend testing with different frame rates to see what fits your game the most.

Hope this guide will help!

Comments
Guest
Guest

Hello! Thank you for this trick, it is very useful) Maybe you found some other tricks? I experienced with 2D Unity game, killing my full battery in 1 hour ((( For exapmle Angry Birds or Cut the rope lives for 3-4 hours without any phone heating. I even thought about other engines, because of Unity's energy consumption.

Reply Good karma Bad karma0 votes
Pingu Author
Pingu

Hi! It mostly comes down to graphics settings. Take a look at the settings under Edit->Project Settings->Quality. Depending on your type of game you may not need all of the fancy rendering and can lower some settings.
Hope it helps!

Reply Good karma+1 vote
BloodyPommelStudios
BloodyPommelStudios

Wow that's surprisingly simple. Thanks.

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Follow Report Profile
Icon
Labyrinth Robots
Platforms
Android
Creator
Pingu
Engine
Unity
Contact
Send Message
Release date
Game watch
Follow
Purchase
Tutorial
Related Games
Related Engines
Unity
Unity Commercial
Related Groups
Android Fans
Android Fans Hardware & Tech with 485 members
Indie Devs
Indie Devs Hobbies & Interests with 1,610 members
Unity Games
Unity Games Hobbies & Interests with 1,771 members
Got it!

We have recently updated our privacy policy and terms of use in-line with GDPR requirements. More Info?