@VOXELIUM Thanks for sending the reproduction project.
You seem to have misunderstood how AnimationState.SetAnimation()
works. You are calling it every frame with the same animation, which re-starts it over and over again. SetAnimation()
is intended to be called once for each animation change.
Changing your code to the following resolved any issues and plays back the animation normally:
IEnumerator Start()
{
yield return new WaitForSeconds(1.0f);
GunShot();
}
Having stumbled upon it, you can also simplify the following code from
if (ON == true)
{
ON = false;
}
else
ON = true;
to
ON = !ON;
In general it's highly recommended to get familiar with the spine-unity runtime first by following the examples. Be sure to check out the example scenes in Spine Examples/Getting Started
that come with the spine-unity runtime. There is also a documentation section about it including a video.
In general the following documentation pages should be helpful as a first point of reference in case of any problems:
https://esotericsoftware.com/spine-unity#FAQ
https://esotericsoftware.com/spine-unity
https://esotericsoftware.com/spine-api-reference