Lion Christ

I am using Skeleton Mecanim to animate my player, and all but one of my animations works fine. I have idle, run, jump, land, hurt, and attack. However, when I jump, the animation is only the very first frame of the animation and nothing else. Landing after jumping still plays the whole land animation. I am using no blend trees. In the SkeletonData inspector window, each animation is previewed correctly when play is clicked. I have tried Force updating the the animation clips, updating Spine-Unity script, and restarting Unity, but to no avail.

Another interesting thing is that if I create animation reference assets for said SkeletonData, and then play the game one time, a couple things happen.

1. I can no longer preview the jump animation via reference asset (jump animation still able to be previewed in the SkeletonData, all other animations still able to be previewed in reference assets)
2. When I click on the jump reference asset, I get an infinite number of errors cycling back and forth between the two following errors:
-NullReferenceException: Object reference not set to an instance of an object
Spine.Unity.Editor.SkeletonInspectorPreview.DrawTimeBar (UnityEngine.Rect r) (at Assets/Spine/Editor/spine-unity/Editor/Asset Types/SkeletonDataAssetInspector.cs:1146)...
-ArgumentException: GUILayout: Mismatched LayoutGroup.repaint
UnityEngine.GUILayoutUtility.BeginLayoutGroup (UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options, System.Type layoutType) (at <35bab3c7b0dc4999845bcfccc7758d96>:0)

This is the code referenced in the NullReferenceException:
var evRect = new Rect(barRect) {

Any ideas?
Lion Christ
  • Posts: 7

Harald

We are sorry for the trouble! Which versions of Spine and the s[ine-unity package are you using?
If both are at the latest version: Could you please send us a zip package of the problematic assets to contact@esotericsoftware.com? Then we can have a look at what's going wrong.
User avatar
Harald

Harri
  • Posts: 2091

Lion Christ

Spine and spine-unity package are up to date. I sent a zipped google drive link of the unity project, but if this is too difficult/too big to access, I can email the zipped spine assets and script assets.

Also, when looking through the spine-unity Runtime Documentation, I found this:
"spine-unity supports 2D Toolkit and can render Spine skeletons using TK2D's texture atlas system. To enable 2D Toolkit compatibility, open Unity's Preferences via Edit -> Preferences... and in section Spine select Define TK2D - Enable." However, the "Define TK2D" is not listed in preferences. Is this old and no longer a thing due to 2D Toolkit only being supported up to Unity 2018.4?
Lion Christ
  • Posts: 7

Harald

Thanks for your email, we received everything. We will get back to you as soon as we have discovered what's going wrong.
Lion Christ wrote:However, the "Define TK2D" is not listed in preferences. Is this old and no longer a thing due to 2D Toolkit only being supported up to Unity 2018.4?
The preference entry is only displayed when the TK2D package is present in your project. This was a safety measure against accidentally clicking it.

---

The problem lies only with your use of Mecanim, it is not related to Spine or spine-unity.
You are using a bool parameter as transition condition from the AnyState node:

TransitionViaBool.png


This will constantly trigger the transition from AnyState to Jump, since the condition remains true until grounded again.
Here you would rather use a trigger instead of a bool parameter. We would recommend to get used to Mecanim first and perhaps watching a few tutorials on typical setups and best-practices.
You do not have the required permissions to view the files attached to this post.
User avatar
Harald

Harri
  • Posts: 2091

Lion Christ

Thanks for your response. I actually was following a tutorial (that uses sprites instead of Spine) that has it set up this way and seems to work fine, hence my confusion. However, your insight makes sense, and I will look into addition tutorials to try to understand why the original tutorial is working. I appreciate the responses and apologize for wasting Esoteric's time >_<.
Lion Christ
  • Posts: 7

Harald

You're welcome, thanks for your kind reply, and no worries about wasting our time.

In general the Mecanim transitions and playback status (where the blue plackback progress bar currently is) is in the hand of Unity and you only, Spine or spine-unity just reads the current status received from Mecanim. So if the blue bar is not where you want it to be, it's not Spine-related but related to the Mecanim Controller logic.
Lion Christ wrote: I actually was following a tutorial (that uses sprites instead of Spine) that has it set up this way and seems to work fine, hence my confusion. However, your insight makes sense, and I will look into addition tutorials to try to understand why the original tutorial is working.
Oh, that's bad. Perhaps you could notify the author of the tutorial that his setup is problematic, so that you can save others the time and trouble to find it out over and over again.
User avatar
Harald

Harri
  • Posts: 2091


Return to Unity