Search code examples
unity-game-engineaugmented-reality

Unity AR causes lag on the whole game


I'm developing a game which has several minigames, one of them is a AR game, it works as expected but when I close the AR minigame (load other games scenes) , All games run with lag(like 20 fps or even less) which only happens after loading the AR minigame, before loading AR they run smoothly. Should I disable the AR somehow before changing the scene? Is there a way to avoid the lag? thank you


Solution

  • Well, I realized that the problem is that AR limits the FPS to 30 😅 So I solved it by setting the target fps to 60 again and disabling vsync(Idk if that is necessary):

    QualitySettings.vSyncCount = 0;
    Application.targetFrameRate = 60;