• 한국어
  • Unity OnEnable 메서드안에서 SkeletonAnimation 및 SkeletonGraphic 호출

  • Изменено
Related Discussions
...

Unity OnEnable 메서드안에서 SkeletonAnimation 및 SkeletonGraphic 호출 하면

에디터에서는 정상적인 작동을 하지만 Android Device에서 NullReferenceException 오류가 발생합니다.

해결책은 없나요?

SkeletonAnimationSkeletonGraphic 클래스와 어떻게 상호 작용하고 있습니까? 어떤 메서드를 호출하고 있습니까? 널 참조 예외를 발생시키는 코드를 보여 주시겠습니까? 예외가 발생한 위치 (스택 추적을 보여주는 오류 로그 출력)를 확인하는 것도 도움이됩니다.

스크립트를 호출하여 호출하기 전에SkeletonAnimation 또는SkeletonGraphic 구성 요소가 초기화되었는지 확인하여 해결할 수 있습니다.

skeletonAnimation.Initialize (false);

How are you interacting with the SkeletonAnimation and SkeletonGraphic classes, what methods are you calling? Could you please show the code that is causing the null reference exception? It would also help to see where the exception is thrown (the error log output showing the stack trace).

Most likely it can be fixed by making sure the SkeletonAnimation or SkeletonGraphic component is initialized before your script is called by calling

skeletonAnimation.Initialize(false);

답변 감사합니다.

skeletonAnimation.AnimationState 을 호출할 때 발생하는 오류이며 이러한 현상은 사전에 skeletonAnimation.Initialize (true); 함수를 호출하여 해결하였습니다.

물론 Awake() 메서드에서 skeletonAnimation.Initialize (false); 함수를 호출하고 있는것을 확인 하였고 OnValidate() 메서드에서 skeletonAnimation.Initialize (true); 가 호출됩니다. 하지만 OnValidate()는 OnEnable() 보다 늦게 호출되므로 이러한 오류가 발생하는것으로 보입니다.

답장을 보내 주셔서 감사합니다. 자동 번역이 모든 것을 올바로 번역했는지 모르겠습니다. 'OnValidate'가 'OnAwake'보다 늦게 호출되었다고 말씀 하셨나요? 'OnValidate'는 에디터에서만 호출되며 Android 기기의 실제 빌드에서는 호출되지 않습니다.

Thanks for the reply. I'm not sure whether automatic translation has translated everything correctly: Did you say that OnValidate is called later than OnAwake? Please note that OnValidate is called in the Editor only, it is not called in the actual build on your Android device.

6 дней спустя

답변 감사합니다. OnValidate가 에디터에서만 호출되는 것을 확인 하였습니다. 하지만 Android에서 'OnAwake' 호출시 'AnimationState' 가 초기화가 되지 않는 것을 확인 하였고, 이것은 'Null' 로 확인 되었습니다.

번거롭지만 다시 확인 부탁드립니다. 감사합니다.

16 дней спустя

답장이 늦어서 죄송합니다. 휴가 중이었습니다.

내가 의미 한 것은

skeletonAnimation.Initialize (false);

를 호출해야한다는 것입니다.
OnAwake ()에서skeleton.AnimationState가 null임을 알 수 있습니다. 이 호출에 의해 설정되므로 더 이상 null이 아닙니다.

내가 귀하의 질문을 오해하고 다른 문제가 있으면 알려주십시오.


Sorry for the very late reply, I have been on vacation.

What I meant is that you should call

skeletonAnimation.Initialize(false);

in OnAwake(), where you notice that the skeleton.AnimationState is null. It will be setup by this call and thus no longer be null.

Please let me know if I misunderstood your question and you have a different problem.