Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unity 5: Very high CPU usage on Android related to the GI system

Discussion in 'General Graphics' started by arcooke, Mar 9, 2015.

  1. arcooke

    arcooke

    Joined:
    Sep 1, 2014
    Posts:
    29
    I'm new to Unity, and have just started with Unity 5.

    I tested out my very basic scene on Android last night and performance was horrible. GPU usage is fine, but the CPU usage is extremely high, and largely related to GI system according to the profiler. The GI lighting is sucking up ~60% of the CPU usage, and even in a completely blank scene with nothing in it, GI was using 30-40% CPU.

    My game has no moving parts, no special shaders, no update scripts.. just a few models (entire scene, grand total of 2100 triangles). Shadows disabled on everything and no colliders.

    Testing devices: nexus 7 (2013, lollipop), LG G2 (kitkat). Similar results on both.

    Totally empty scene in a brand new project with nothing in it: 80fps
    My scene with just a few non-moving, useless gameobjects, 3 materials: 13fps
    My scene with only a single diffuse material being reused on all game objects: 36fps
    My scene absolutely with nothing but a skybox, 1 light, 1 camera: 50-60fps

    Android build properties set at the lowest possible settings has no effect.

    This can't be normal...


    EDIT: Finally able to grab some screenshots of my profiler. EnlightenRuntimeManager.UpdateEnvironmentLighting seems to be the culprit. This does not even exist when I profile the editor on my PC.

    This is with everything as optimized as I've been able to get it. It's currently running about 60fps, but there is hardly anything to it.

    On Android:




    In Editor (On pc): EnlightenRuntimeManager.UpdateEnvironmentLighting never appears in the list.




     
    Last edited: Mar 10, 2015
  2. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Looks like the skybox environment data is getting regenerated each frame, which sounds like a bug.

    What is Ambient Intensity set to? Are you animating it?
     
    arcooke likes this.
  3. arcooke

    arcooke

    Joined:
    Sep 1, 2014
    Posts:
    29
    Well... it seems that was the problem. I was rotating my skybox. I tested a build with the script disabled and the entry using so much CPU usage pretty much disappeared, and framerate jumped quite a bit.

    With rotating skybox: 23FPS
    Without: 65FPS

    I was not aware that rotating the sky would cause the lighting system to have to do so much more work

    Thank you very much for the help.

    This is my code for the rotation:
    Code (CSharp):
    1. public float rotationSpeed = 0.85F;
    2. float rot = 0;
    3. void Update() {
    4.         rot += (rotationSpeed * Time.deltaTime) % 360;
    5.         RenderSettings.skybox.SetFloat("_Rotation", rot);
    6.     }