"성공한 사람보다는 가치 있는 사람이 되려 노력해야 한다." – Albert Einstein

2018/07/16

코루틴이 혼자 멈출 때

유니티가 버그가 있는 경우를 제외하고 멈출 위치가 아닌데 혼자 멈추는 이유 대부분은 (당연히) 나의 문제입니다. 다음을 확인해 봅니다.

  • StopAllCoroutines() 아니면 StopCoroutine() 으로 직접 멈춰놓은 걸 잊어버리고 하와와 하는 경우
  • 해당 코루틴을 돌리는 스크립트가 붙어 있는 게임 오브젝트나 부모 오브젝트를 파괴한 걸 잊어버리고 응기잇! 하는 경우
  • 해당 코루틴을 돌리는 스크립트가 붙어 있는 게임 오브젝트나 부모 오브젝트를 비활성화한 적이 있는데 뭐임?? 뭐임!! 하는 경우(아래 링크 참고)
  • 0.0f == Time.timeScale 인 상태에서 해당 코루틴을 WaitForSeconds() 같은 시간 관련이나 WaitForFixedUpdate() 로 양보해놓고 으아니!? 챠! 하는 경우

참조

https://answers.unity.com/questions/34169/does-deactivating-a-gameobject-automatically-stop.html
https://answers.unity.com/questions/480173/how-to-not-stop-coroutines-when-deactivating-a-gam.html
https://answers.unity.com/questions/458780/if-you-disable-a-gameobject-does-an-invokerepeatin.html#answer-458797

댓글 남기기 | cat > 타닥타닥 | tag > ,

댓글 남기기

* 표시된 곳은 반드시 입력해주세요