Search Unity

Help me to identify the reasons of lagging in android

Discussion in 'Android' started by overpowerogue, Jul 11, 2020.

  1. overpowerogue

    overpowerogue

    Joined:
    Oct 25, 2019
    Posts:
    29
    I am very new to profiler analysis in Unity. Can someone please help me to find out the reasons of being so lag of my game in android? It seems like semaphore.waitforsignal is waiting for some process, but I have no idea for further solution to that. Any help is highly appreciated.
    Asking1.PNG asking2.PNG
     
  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,461
    Hi and welcome to the world of profiling. That Semaphore.WaitForSignal occurs on the main thread because it's waiting on the work from the Render thread of the previous frame to finish. I can't tell with absolute certainty if that is Gfx.Present sample but I'd guess so, meaning you'd be GPU bound, and by quite a bit. Without GPU Profile data or more of a hint as to what the GPU has to work on, it's going to be hard to give you many pointers beyond that.

    Note that you might want to take a look at the Profiler manual pages as well as the Unite Now talk on Profiling to get more familiar with the Profiling tools and these samples.

    You also seem to be on a version that is not the latest available patch version on that major version Stream, or an otherwise no longer supported version, as the Others category in the chart isn't showing and the Rendering category seems to not count the Semaphore's waiting time. Not that updating to the latest patch would necessarily help with your issue, but it should clarify the Profiler's chart and it should generally be a more stable version with less bugs.

    Also, what phone are you testing on? Could it be that it is just not powerful enough?
     
    Ryiah likes this.
  3. overpowerogue

    overpowerogue

    Joined:
    Oct 25, 2019
    Posts:
    29
    I test it on Huawei P9 phone. I did test on latest 2019 smartphone, and it worked really smooth, however in Huawei P9, the game is laggy. I hope that my game would be available for most of the smartphone, at least can run smoothly on my smartphone, since it was high-end phone at 2016.
     
  4. overpowerogue

    overpowerogue

    Joined:
    Oct 25, 2019
    Posts:
    29
    What does GPU bound meant? If so what should I improve on my game? I did put all the non- moving objects as static for batching, and all the textures had been reduced to at most 512 pixel. Still, it is laggy on my phone
     
  5. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,461
    It means your CPU would be done with calculating a frame within 16-66ms (60-15 fps) depending on the frame, but the GPU takes ~145 ms in that screenshot (+/- because I'm not factoring in the waiting for vSync which the mobile OSs enforce), where the CPU would've otherwise taken ~33ms.

    Static batching helps reduce rendering time on the CPU. The GPU performance is more affected by shader complexity and fill rate. If Unity's GPU Profiler doesn't give you any info on this, you might have to look at a profiler from the GPU manufacturer of the phone's GPU, and/or RenderDoc for more info.

    But I'd say you might be throwing too much at that GPU and might have to scale things down a bit.
     
  6. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,461
    You might also work with Occlusion Culling, LODs, Texture Compression and Mipmaps, Baked lighting and no or limited real time shadows and similar optimization techniques. See this page for details and further pointers.
     
  7. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,461