Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Optimization issues

Discussion in 'Editor & General Support' started by CarBrain, Aug 11, 2019.

  1. CarBrain

    CarBrain

    Joined:
    Mar 19, 2018
    Posts:
    1
    Hello dears! I create a game for Android and recently, when I started the game on the phone I saw a small FPS (20 - 30). Then started profile (looked at statistics on phone) and saw that Initialization.PlayerUpdateTime and Gfx.WaitForPresentOnGfxThread spend a lot of time(Screenshots below) . After 5 hours of wandering on the Internet nothing really helped me. I'm using Unity 2019.2.0f1. Thanks for help!
     

    Attached Files:

  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    281
    Hi there,
    The time spend in
    Initialization.PlayerUpdateTime
    is fully spend in
    WaitForTargetFPS
    which makes that the relevant sample to look at. As a sub-sample of
    Initialization.PlayerUpdateTime
    ,
    WaitForTargetFPS
    is caused by having Application.targetFrameRate set to a frame rate that is lower than what the application could run at. To lower battery consumption and heat buildup (which would eventually lead to throttling by the OS which could destabilize frame rate), mobile platforms only allow you to set the target frame rate to 60 and will default to 30 when Application.targetFrameRate is set to -1 (or left at that default value).

    You can set the frame rate to 60 to run at that frame rate, just keep in mind that you might still be VSynced to 30 FPS so also set QualitySettings.vSyncCount to 0 or 1 (1, because on mobile you're still bound to 60 FPS anyways)

    Regarding Gfx.WaitForPresentOnGfxThread:

    This sample indicates that the main thread is ready to start rendering the next frame, but the render thread has not finished waiting on the GPU to present the frame. This might indicate that your application is GPU-bound. To see what the render thread is simultaneously spending time on, switch from Hierarchy view toTimeline view.

    If the render thread spends time in Camera.Render, your application is CPU-bound and might be spending too much time sending draw calls or textures to the GPU.

    If the render thread spends time in Gfx.PresentFrame, your game is GPU-bound or it might be waiting for VSync on the GPU.
    A WaitForTargetFPS sub-sample of GFX.WaitForPresent indicates the portion of the Present phase that your application spends waiting for VSync.
     
    futurlab_peterh likes this.