• Unity
  • using Spine Animation a script in Unity

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

как запустить импортированную из Spine анимацию с помощью скрипта в Unity? С ПОМОЩЬЮ СКРИПТА. Просто импортировать и выставлять в GameObject - не то. К каким объектам, к камим полям обращаться? Какие библиотеки подключать? Точнее интересует подключение через СкриптаблеОбъект.

How to run an animation imported from Spine using a script in Unity? BY SCRIPT. Just importing and exposing to GameObject is not it. What objects, to kim fields should I contact? What libraries to connect? More precisely, the connection through the Scriptable Object is of interest.

Я не уверен, что правильно понял ваш вопрос.
Если вы спрашиваете, как инстанцировать скелет с помощью скриптинга, пожалуйста, посмотрите на примере сцены Spine Examples/Other examples/Instantiate from Script, которая поставляется с runtime spine-сообщества.

I'm not sure I understand your question correctly.
If you are asking how to instantiate a Skeleton via scripting, please have a look at the example scene Spine Examples/Other Examples/Instantiate from Script that comes with the spine-unity runtime.

found Spine recommendations for using code

using Spine.Unity;

public class YourComponent: MonoBehaviour {

    SkeletonAnimation skeletonAnimation;
    Spine.AnimationState animationState;
    Skeleton skeleton;

    void Awake () {
       skeletonAnimation = GetComponent <SkeletonAnimation> ();
       animationState = skeletonAnimation.AnimationState;
       skeleton = skeletonAnimation.Skeleton;
    }

In the line Skeleton skeleton; throws error CS0246 C # The type or namespace name could not be found


Itself has already decided the issue. Another library needed to be connected
using Spine;

Glad you figured it out.

Please have a look at the example scenes that come with the spine-unity package in Spine Examples/Getting Started, it contains working example scenes with code that you can use as a template.