기술/유니티 스터디
중요한 기초 yield return null
송현국
2022. 5. 12. 10:33
반응형
아주 사소한거 같지만 중요한 StartCoroutine 시 yield return null;
즉, Update() 함수 호출 순서가 중요할 때가 있는데 이 함수를 한 번 호출하기 위해 yield return null;을 사용할 수 있다는 것
Start()
{
StartCoroutine(DoSometing());
}
Update()
{
Debug.Log("Update");
}
IEnumerator DoSometing()
{
Debug.Log("Before");
yield return null;
Debug.Log("After");
}
결과
Before
Update
After
출처
유니티 - 코루틴에서 yield return null 사용하기 (tistory.com)
유니티 - 코루틴에서 yield return null 사용하기
유니티 - 코루틴에서 yield return null 사용하기 1)아래 유니티의 이벤트 함수 실행 순서에서 정상적인 코루틴 업데이트는 Update 함수가 호출된 이후에 실행되는것을 확인할수있다. https://docs.unit
learnandcreate.tistory.com
반응형