개발 이야기/개발 및 서비스
Unity에서 다른 클래스의 코루틴 호출하기
가온아
2015. 4. 7. 17:49
패치 모듈 만들다가 패치 모듈의 코루틴을 써야되는 상황일 때..
StartCoroutine은 non-static member function입니다.
결론만 간단히 ...
아래와 같이 활용하세요.
// 활용 코드
Test test = GameObject.Find("TestPrefab").GetComponent<Test>();
yield return test.StartCoroutine( test.startPatch());
(in Test.cs)
// 샘플 Test class 선언 형태
public class Test : MonoBehaviour
{
public IEmumerator startPatch(){
.
.
.
}
}
* TestPrefab을 만들어서 Test script 연결해 해당 씬에 등록하세요.
반응형