Search Unity

Does Unity call Start() when OnApplicationPause(true)

Discussion in 'Scripting' started by swifter14, Jun 13, 2018.

  1. swifter14

    swifter14

    Joined:
    Mar 2, 2017
    Posts:
    165
    When receiving an incoming call, OnApplicationPause(false) is called, and when returning back to the app OnApplicationPause(true) is called. What's going to happen when returning? Do all my gameobjects on the scene (with scripts attached) run Start() again? If so that's bad because it'll reset everything to default in my case. I read different answers on different sites, I wonder why it's not clear.
     
  2. MSplitz-PsychoK

    MSplitz-PsychoK

    Joined:
    May 16, 2015
    Posts:
    1,278
    The Start() function runs only once right before an object's first update. Once the Start function has run for an object, it will not run again unless you specifically call Start() yourself.
     
    swifter14 likes this.
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,689
    swifter14 likes this.