Search Unity

Question How do you pause the entire app?

Discussion in 'AR' started by swifter14, Dec 27, 2022.

  1. swifter14

    swifter14

    Joined:
    Mar 2, 2017
    Posts:
    165
    I use this -
    if (timeSinceLastClick > 60)
    {
    Time.timeScale = 0;
    }
    But that doesn't freeze either the camera/ar tracking or audio. Besides the animation, everything else seems to keep running.
    I'd like to pause the app completely so the users can save their battery and avoid heating
     
  2. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,062
    To pause Audio:
    AudioListener.pause = true
    (https://docs.unity3d.com/ScriptReference/AudioListener-pause.html)

    Note that you can't pause an AR Session, per se, but you can disable it. From our docs:

    When you disable the AR Session component, the system no longer tracks features in its environment. Then if you enable it at a later time, the system attempts to recover and maintain previously-detected features.
     
    newguy123 likes this.