멀티 플레이 게임에 Appwarp API를 사용하고 있습니다. 내가 Invoke("recoverConnection", 5)
로 전화 할 때 오류가 발생합니다.단일 스레드 오류를 해결하는 방법 "호출은 주 스레드에서만 호출 할 수 있습니다"?
public void onConnectDone(ConnectEvent eventObj)
{
Log ("onConnectDone : " + eventObj.getResult());
if (eventObj.getResult() == 0)
{
recoveryErrorCode = 0;
WarpClient.GetInstance().JoinRoomInRange (0, 5, true);
}
else if (eventObj.getResult() == 9)
{
this.Invoke("recoverConnection", 5);
}
else if (eventObj.getResult() == 8)
{
// reconnected
}
}
void recoverConnection()
{
WarpClient.GetInstance().RecoverConnection();
}
오류는 다음과 같습니다 호출 만 메인 스레드에서 호출 할 수
.
생성자와 필드 초기화 프로그램은 장면을로드 할 때로드 스레드에서 실행됩니다.
이 작업을 수행하십시오. http://blog.kibotu.net/unity-2/unity-start-coroutines-main-thread-anything-else-matter – turnipinrut