Search Unity

Framerate drop from 30 to 20 after switch to Background and came back

Discussion in 'AR' started by icyuan, Apr 13, 2020.

  1. icyuan

    icyuan

    Joined:
    Jul 21, 2019
    Posts:
    6
    It looks so strange that after i go to the phone home page, the WaitForTargetFPS increase.
    I have set the Application.targetframerate = 30 and vSyncCount = 0;
    if I don't switch to background, it will keep 30 fps all the times;
    upload_2020-4-13_15-4-13.png
     
  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,457
    Hi!
    What phone are you seeing this happen on and/or what is the refresh rate of that phone's screen?
    if it is 40Hz it could be because of that. Not sure why that should only happen after a focus change though.
    Could you please also check if anything in your project registers to the Application.focusChanged event or if you have any script that implements MonoBehaviour.OnApplicationFocus? Maybe something in there is trying to reset the targetFrameRate or vSyncCount on resuming focus.