• Runtimes
  • unable to get animation component in unity

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

I'm new to spine so maybe there's something obvious I'm missing but here's what I've done so far.

SkeletonAnimation anim;
anim = GetComponent<SkeletonAnimation>();
anim.state.SetAnimation( 0, "Hit", false );

Изображение удалено из-за отсутствия поддержки HTTPS. | Показать


Изображение удалено из-за отсутствия поддержки HTTPS. | Показать

My issue is that anim is always null even though it clearly exists in the inspector.

I would also like to add that I'm able to get the component on the main character in my game but not on the hammer object, and from what I can tell there's no warnings.

Is this code by any chance in Awake or Start?

It was my fault I had an old game object with the same name linked in the code as versus the new game object. Works great now thanks.