Awake와 Start의 호출 순서
2011. 5. 3. 08:55ㆍC# And Unity
호출 순서는 아래와 같습니다.
Awake => Start => Update
Awake : 이 스크립트를 사용하는 인스턴스들이 Start하기전에 무조건 딱한번 실행됩니다.
Start : 이건 현재 인스턴스가 활성화될때 Update 바로 직전 호출됩니다. (이것도 딱1번입니다.)
예를 들면 즉 이 스크립트를 사용하는 인스턴스가 1,2 가 있다면
Awake1 - Awake2 - Start1 - Start2 (0)
Awake1 - Start1 - Awake2 - Start2 (x)
가 됩니다.
Start is called just before any of the Update methods is called the first time.
Start is only called once in the lifetime of the behaviour. The difference between Awake and Start is that Start is only called if the script instance is enabled. This allows you to delay any initialization code, until it is really needed. Awake is always called before any Start functions. This allows you to order initialization of scripts.
The Start function is called after all Awake functions on all script instances have been called.