• Unity
  • Problems with animation

Hi,

first of all, great job on developing this software, it's making a bunch of lives a lot easier. Next, I know this will sound stupid, but I'm a beginner considering both spine and unity, I'm running both software latest release, and I'm stuck when I export .json file following your tutorial on exporting.. i get all the necessary data into spine, .json file atlas file png sprite sheet skeleton data materials and when i go on instantiate (skeletonAnimation) if i remember correctly, it creates a gameObject with my character but no animations are attached that I created in Spine.. when I click on skeletondata I see all the animation previews under setup pose, but on the created gameObject the animator or animations are both empty.. I know the problem is probably something I'm missing or doing wrong and super easy to fix.. but I'm still stuck, sry for wasting your time. 😛

Tnx in advance.

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

Is there something in the way you named your animations that might have caused problems?

i get this warning when i import spine runtime for unity. the latest one. and my animations in spine are named "walk, idle, attack". When I use the BAKE method, everything is correctly, in animator I can see all the animations correctly, but I decided to avoid BAKE method, since I'm using draw order keys in spine, and that is not exported using this method.

Those errors are harmless.
That second one is also only from the sample assets. You can delete that folder from your project.

I can't imagine why else SkeletonAnimation's animation list would be empty.
Also, just to be sure, what exactly did you mean by "the animator or animations are both empty."? Can you send a screenshot of that?

http://i.imgur.com/aUeZ8Yf.png
http://i.imgur.com/IIZulFT.png
http://i.imgur.com/4mP4B4c.png
http://i.imgur.com/UBIK9qy.png
http://i.imgur.com/MVXcX0k.png
http://i.imgur.com/IY7BXXO.png
http://i.imgur.com/6sYVoVM.png

here are all step by step stuff that I'm doing. last one, when I create a gameObject with "instantiate (skeletonAnimation)" the game object has no animation that I created before in spine attached.. I'm probably missing something really stupid, but still cant manage to get it to work.

Thank you for your time.

Errmm... are you expecting it to fill out the standard Unity Animations window? O.o

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

You click on this and you get nothing?

When I select this, the animation I want is looping, but the other 2 I have, cant get them to import in unity animator so I can switch states when I program the controller for idle > walk > jump. The animator is empty, but when I use BAKE method I can see all three animations exported correctly in animator.

SkeletonAnimation does not use Animator. That's what SkeletonAnimator is for. Baking is a 3rd option that you should never use unless you REALLY have to.

To use SkeletonAnimator, you will need to add the clips to your Runtime Animator Controller just like any other Unity animated object.

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

Hi,

thank you for all of your assistance, did everything like that, still couldn't get it to work, I guess I'm still to much of a newbie, anyway we sorted this out from the programmers side of view. This is the code that is working fine.

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

public GameObject myPlayer = null;

private SkeletonAnimation playerAnimation = null;
// Use this for initialization
void Start () {
playerAnimation = myPlayer.GetComponent<SkeletonAnimation> ();
playerAnimation.AnimationName = "idle";
playerAnimation.loop = true;
}

// Update is called once per frame
void Update () {
if (Input.GetKey ("c")) {
playerAnimation.AnimationName = "attack";
playerAnimation.loop = false;
}
else if (Input.GetAxis ("Horizontal")==0.0f) {
playerAnimation.AnimationName = "idle";
playerAnimation.loop = true;
}
else if (Input.GetAxis ("Horizontal") != 0.0f) {
playerAnimation.AnimationName = "walk";
playerAnimation.loop = true;
}

}
}

Just to be clear, since you're new to Unity.

Spine's internals don't work through Unity's built-in animation system. So if you're still watching Unity tutorials or whatever, those things don't apply when you're using Spine.

If you use SkeletonAnimator, it allows you to use the Mecanim Animation Controller, but what it does is generate empty dummy Unity AnimationClip assets and uses their durations to control and mix between the actual Spine Animations under the hood. Rendering and the actual Animation data is still outside of Unity's animation system.

Thank you 🙂