안 쓰던 블로그

[유니티] 에러 MissingReferenceException: The object of type 'RectTransform' has been destroyed but you are still trying to access it. 본문

유니티/개발

[유니티] 에러 MissingReferenceException: The object of type 'RectTransform' has been destroyed but you are still trying to access it.

proqk 2021. 8. 3. 19:24
반응형

MissingReferenceException: The object of type 'RectTransform' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object.

 

오브젝트를 Destroy 하려는데 이런 에러가 뜬다면..

어딘가에서 선언한 RectTransform이 private라서 접근이 안 되는지 확인

혹은 다른 함수 안에서 선언해서 함수가 종료되면서 Destroy 되어버린 게 아닌지 확인

Destroy하는 시점에 해당 게임오브젝트의 RectTransform에 접근 가능할 수 있으면 해결 

반응형
Comments