Hello!
skeletonAnimation.state
is not guaranteed to exist in OnEnable, since SkeletonAnimation auto-initializes in its Awake. It works in Start
though. This is in accordance with Unity's recommended uses of the Awake, Start and OnEnable methods.
So it's recommended you start and set your animations in MonoBehaviour.Start
.
But if you have no other choice in your logic, you can call skeletonAnimation.Initialize(false)
before trying to use your SkeletonAnimation in an initializing method.
For example:
void OnEnable () {
Invoke("YourMethod", 1.6f);
skeletonAnimation.Initialize(false);
skeletonAnimation.state.SetAnimation(0, "whatever", true);
}