# Why does my Unity/Android game get a small amount of lag when not being touched for some time?

I have made a 3d version of space invaders. I made all the assets myself in Blender. I feel that it's a very basic game and my Galaxy Note 3 test device should handle it no problem. (Although it's a few years old now so perhaps some kind of shader issue or something that my phone not updated enough for ?)

There are 55 enemies all with one mesh each. There's the flying saucer model and the player model.

Then there's a plane for a background, and 4 defensive meshes (although I've tested without these and the result is the same).

Basically, it all runs superbly (I have turned down much of the lighting and graphics quality etc, but have left basic shadows in). However I notice that if the player just lets the phone sit there in game without touching it, there is very slight (but noticeable) frame lag.

All the enemies have a very short animation which moves its arms a small amount.

I could post the code but its massively unorganized and really quite an embarrassment (HAHA!). Also I'm not sure what parts are relevant so it would be a huge post.

Is there any known issues that can cause the lag only when not being touched? As I feel like some of my old projects might have had this happening too but they've been deleted now unfortunately so I can't really dabble with it.

It works smooth as silk in the Unity Editor Android 'emulator' and as I say, if I actually play the game on my phone it's smooth too.

Most likely the phone goes into power saving mode and reduces CPU/GPU speed when there is no user interaction for a while.

This is at the OS level.

There may be a setting on your phone to disable this behaviour but your battery life will suffer as a result.

You can have a look at the Screen.sleepTimeout property and initialize it to:

 Screen.sleepTimeout = SleepTimeout.NeverSleep;