Search Unity

Time between Awake and Start

Discussion in 'Editor & General Support' started by JoshOClock, Apr 24, 2014.

  1. JoshOClock

    JoshOClock

    Joined:
    Dec 8, 2010
    Posts:
    107
    I'm trying to get load times down. I put some logs my first Awake() (set via Script Execution order) and the same script's Start().

    For some reason there is a 2s gap between those two calls. So far I've put logs in every other Awake and Start I can find and I can't account for that delay.

    Is Unity doing something for those 2s between the Awake and Start that I can't account for? (Or improve?)
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    Is that 2s measured in terms of Time.time? Or in terms of just observing the Console? Or what? Is the game running during those 2s? If you have other Debug.Logs in the same script's Update(), do they appear in the log before the one in Start()?
     
  3. JoshOClock

    JoshOClock

    Joined:
    Dec 8, 2010
    Posts:
    107
    My timings are based on Time.realTimeSinceStartup.

    I can't really be sure what the game is doing in those 2s. It's too quick to tell and I don't see any other logs so I'm not sure where it's going.

    The Update shouldn't get called before Awake and Start should it...? I'll take a look though.
     
  4. JoshOClock

    JoshOClock

    Joined:
    Dec 8, 2010
    Posts:
    107
    Update: No updates get called between Awake and Start.

    I was never able to account for the time. As a partial solution I now use Awake to start a few prewarm coroutines that allow me to do some computations during the 2s gap.

    If you can't beat 'em, join 'em...?