CPU usage always high on all types of iphone

My game runs well on Iphone 5. When I use XCode to debug it, i saw:

 - CPU usage: about 90~110%
 - Energy impact: "very high"
 - FPS: 30

Then I tested on Iphone 7 plus, I saw :

 - CPU usage: about 90~110%
 - Energy impact: "very high"
 - FPS: 60

and the device is quite hot. So I think maybe FPS is the cause. Then I set frame rate to 30, and test again in Iphone 7 plus. This is the result:

 - CPU usage: about 90~110%
 - Energy impact: "very high"
 - FPS: 30

As you see, the FPS has changed, but CPU and Energy impact did not change at all, and the device still hot! I did not use network at all, this game is totally local, and it even run well on iphone 5 without a lag!
Is this a bug of Unity 5? Can someone tell me why?

I somehow fixed it by myself. These are the steps:

  • Set FPS to 30 by Application.targetframerate.
  • Force use OpenGLES2 in Player Settings / Other Settings / Graphics APIs
  • Set resolution to half width, half height (only iphone 6 plus, 7 plus) by Screen.SetResolution
  • Force build 64-bit by set “Scripting backend” to IL2CPP and Architecture to ARM64 in Player Settings / Other Settings / Configuration


After these configs, I tested on my Iphone 7 plus and this is the result:

  • CPU usage reduce (from 90~110%) to 50~80%
  • Energy impact is still “very high” but it also decreased a bit
  • Overheat: before these steps, device got extremely hot after 10 minutes of play. Now it just become warm a bit after 40 minutes of play.

I’m getting high CPU usage too around 40-80% at 60FPS. I want to run the game at 60 because the animations are smoother but the idle CPU usage is really high.

I experimented with putting the Application.targetframerate down to 1 when the game was idle and it drops the CPU usage down to 5%, which is what I’d expect the idle to be at any frame rate. I would then increase it back to 60FPS when someone interacted with the game. It doesn’t change fast enough though so it stutters for a couple of frames before reaching 60 again.

I don’t see why Unity needs to be doing anything except checking for inputs when apps are idle. 50% CPU is a crazy amount to be wasting. It’s half of one of the cores so not 50% of the whole device but still really bad for idling.

When I check the FPS profile in XCode, my frame times are CPU: 16ms, GPU: 3ms so it looks like something is working the CPU far more than the GPU but I can’t see what’s doing it. When I try to debug the code using Instruments, I get this error:

Instruments: Unable to unarchive payload for < DTXMessage 0x7fec0e3c7e30 : i383.0 c9f object:((null)*)nil >: *** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (DTKTraceTapMessage) for key (root); the class may be defined in source code or a library that is not linked

In Unity’s profiler, it says that WaitForTargetFPS is using the most CPU, which is a VSync thing but I get the same CPU usage on iOS even disabling VSync in the quality panel. I still wouldn’t expect the CPU to be doing this for VSync because the GPU frame time is 3ms so there’s nothing the CPU has to wait for.