'skeletonAnimation' Does Not Exist

Hey guys,

I’m trying to have my character change animations that I’ve created in Spine. I’ve come across an issue using the manual found here:

http://esotericsoftware.com/spine-unity#Importing-into-Unity

When I write a line of code that says:
if (rb.velocity.magnitude > 1)
{
skeletonAnimation.AnimationName = "Walk";
}

I get an error code CS0103 that says:
The name ‘skeletonAnimation’ does not exist in the current context

Thanks in advance for the help!

There is no variable named skeletonAnimation, you should make a variable named skeletonAnimation.

Yeah, I actually tried to set a variable earlier but just got confused by an error I received. I had originally put this declaration at the top:
SkeletonAnimation skeletonAnimation;

However, I get this error CS0246:
The type or namespace name 'SkeletonAnimation' could not be found. Are you missing a using directive or an assembly reference?

I actually just found this declaration in the “SpineBeginnerTwo” script in the Examples folder of the Spine-Unity runtime package, so I’m not sure why it gives me an error when I reproduce that.

Errors are great, they explain everything that is going wrong.

Its complaining that the name SkeletonAnimation could not be found, and suggesting you look at a using directive or assembly reference. This resource explains everything about using directives.

Ah, I see I needed a “using Spine.Unity;” line at the top. Thanks!

No problem! Glad that you solved the problem yourself.