Search Unity

Resolved Why does returning from an AR scene make frame rate drop

Discussion in 'AR' started by jiraphatK, Dec 25, 2020.

  1. jiraphatK

    jiraphatK

    Joined:
    Sep 29, 2018
    Posts:
    300
    I've noticed a notable performance drop when returning from the AR scene.

    I'm wondering if there is any magic method I need to call to release all resources that the ar session occupied?

    I've attached a video file that shows the problem



    Notice the jitter of scrolling after returning from AR.

    This only happened after ARFoundation scene. This project contains scenes with Wikitude AR plugin for marker and object tracking but coming back from those 2 scenes did not result in performance drop.
     
  2. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,145
    ARSession.matchFrameRate is the cause. When this setting is enabled, AR Foundation will execute this code:
    Code (CSharp):
    1. Application.targetFrameRate = FPS_THAT_CURRENT_AR_PROVIDER_SUPPORTS;
    Almost all Android devices support only 30 fps video in AR, so your target framerate will be set to 30.
    To solve your issue, please either disable the matchFrameRate setting OR set the Application.targetFrameRate to the desired value after you exit the AR mode.
     
    AbgaryanFX and jiraphatK like this.
  3. jiraphatK

    jiraphatK

    Joined:
    Sep 29, 2018
    Posts:
    300
    Thank you!