IndieDoroid

Hi guys,

I'm using Spine's events inside Unity. Each time I update the Spine animations I need to reapply the integer values inside Unity, because they all get reset to 0.

Is there a faster way to remember the integer values saved inside Spine and have those automatically save over to Unity?

You can see inside unity the Int went back to 0. But, inside Spine I saved the key as 1.

Thanks
You do not have the required permissions to view the files attached to this post.
User avatar
IndieDoroid
Posts: 36

Pharan

I didn't write this part of the code, but from reviewing it, it looks like the Spine event's integer is pushed into animation events as its float parameter. I'm not sure why this decision was made, but it should be easy to change.

---

If you want to apply this immediately, you can find this line in SkeletonBaker.cs
spine-runtimes/SkeletonBaker.cs at 3.6

Then change it from:
ae.floatParameter = (float)ev.Int;
to
ae.intParameter = ev.Int;
This might have been a holdover from a previous version of Unity but I'm not sure yet. I need to review how this works before applying it to the runtime officially.
User avatar
Pharan
Posts: 5366

IndieDoroid

I'm not a programmer, but I'm guessing maybe that was a float because the Spine Event also accepts float values? (Int, Float, String)

Am I the only one to bring this bug up before? It'd be a shame if no one else is using this cool feature.

I'll wait for you guys to do an official update. I'm a bit paranoid to play around with Spine's scripts. :doh:

Thanks

---

Hi @Pharan,

Ok I think I broke Spine... I can't seem to export the integer values anymore.

I'm getting this red error when I try to export the character. I tried to "Force Update AnimationClips" and also "Reload" from the skeletonAnimator. I can see the Spine Event in the Animation tab, but unity isn't recognizing it. Any suggestions?

---

Ok noticed that Spine was updated. There are new options for the Animation Event in Unity now. I'm guessing the old animation controller isn't recognizing these new updates... hence the error messages I attached.
You do not have the required permissions to view the files attached to this post.
User avatar
IndieDoroid
Posts: 36

Pharan

There wasn't any change to the Spine-Unity runtime regarding this area until now. Nothing has been applied to 3.6 yet. I think the most likely reason behind the old code was that pre-Unity 5.6 handling.

I've also looked into how Animation Events behave, including inspectors. It seems like they do indeed serialize all those fields at once (floatParameter, intParameter, stringParameter, object), they really only support one at a time. The inspector you show in the first screenshot seems to appear when you select an animation without having a specific Animator object beforehand, which means it can't find out what functions are available for it to call in its sibling components.

This weird inspector behavior has nothing to do with Spine. This is how Unity behaves out of the box.


In any case, I've applied the change I mentioned above to the spine-unity 3.7-beta runtime.
It will be safe for you to apply the change I've mentioned above if you are still in 3.6. Not sure if we'll decide to backport this change.
User avatar
Pharan
Posts: 5366

IndieDoroid

Hi Pharan,

Sorry I missed this reply.

I just updated to 3.7 beta and I ran into a couple errors.

#1) SkeletonAnimator doesn't exist. I found that SkeletonAnimation is ok, so I renamed those. (I was using this to change materials using the SkeletonAnimator (3.6), but not sure if SkeletonAnimation works this way because I can't run the build due to #2

#2) Unity is giving me an error with the Animationtools.cs (Attached image)

Any help would be appreciated!

---

UPDATE
Unity 2018.2.13f1

I removed the entire SPINE folder and tried installing.
I'm noticing that I can't install Spine\Editor\spine-unity. Unity won't let me check it "ON".
I now have these errors
NullReferenceException: Object reference not set to an instance of an object
Spine.Unity.SkeletonUtility.OnDisable () (at Assets/Spine/spine-unity/SkeletonUtility/SkeletonUtility.cs:170)
NullReferenceException: Object reference not set to an instance of an object
Spine.Unity.SkeletonUtility.OnEnable () (at Assets/Spine/spine-unity/SkeletonUtility/SkeletonUtility.cs:153)
NullReferenceException: Object reference not set to an instance of an object
Spine.Unity.Editor.SkeletonUtilityInspector.OnEnable () (at Assets/Spine/spine-unity/SkeletonUtility/Editor/SkeletonUtilityInspector.cs:61)
NullReferenceException: Object reference not set to an instance of an object
Spine.Unity.SkeletonUtility.CollectBones () (at Assets/Spine/spine-unity/SkeletonUtility/SkeletonUtility.cs:211)
Spine.Unity.SkeletonUtility.Start () (at Assets/Spine/spine-unity/SkeletonUtility/SkeletonUtility.cs:166)
NullReferenceException: Object reference not set to an instance of an object
Spine.Unity.SkeletonUtility.Update () (at Assets/Spine/spine-unity/SkeletonUtility/SkeletonUtility.cs:124)
You do not have the required permissions to view the files attached to this post.
User avatar
IndieDoroid
Posts: 36

Pharan

1. You may want to give this topic a read.
Spine-Unity 3.6 to 3.7 Upgrade Guide

2.
AnimationTools.cs isn't officially part of the runtime. You probably added that from the different topic.
You can delete that.

The fix here depends on what you were using it for.
If you were just matching all animations, 3.7 includes a "Default Match All Animations" asset which you can add to the relevant SkeletonDataAssets' SkeletonDataModifiers list.
Just look for that asset and add it to each SkeletonDataAsset that you previously needed to process with AnimationTools.
Annotation 2018-12-23 161155.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
Pharan
Posts: 5366

IndieDoroid

Hi Pharan,

I did the update to 3.7 for Unity runtime and Spine. Just letting you know it works!! The integers are now saved from Spine to Unity! Thanks for the help!

:)
User avatar
IndieDoroid
Posts: 36


Return to Unity