Jamez0r

I'm using a multi-SkeletonMecanim setup for characters who have a front/back/side view. The configuration basically hides the views that shouldn't be seen, and only shows the view that should currently be seen (aka if you're walking downward then only the front-facing SkeletonMecanim is shown, etc).

I use the AnimatorController for the front-facing view as a "Master Controller" for the character - the other views use AnimatorControllerOverrides that are linked to it. All other characters also link back to this Master Controller, so essentially all characters and all viewing-angles are linked back to the singular original Master Controller.

This works great in general, but I'm having an issue with a specific thing - certain viewing angles have special animations that the other viewing angles don't have. Like, lets say the front-facing view had an animation where the character is smiling and winking (since you can see their face), but the backside-view doesn't. When the backside SkeletonMecanim goes into the State that plays that animation, I get this error:
NullReferenceException: Object reference not set to an instance of an object
Spine.Unity.SkeletonMecanim+MecanimTranslator.Apply (Spine.Skeleton skeleton) (at Assets/Plugins/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs:270)
Spine.Unity.SkeletonMecanim.Update () (at Assets/Plugins/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs:87)
I've been getting around this issue by creating an Empty Animation in the character's spine project, and just assigning that Empty Animation in the ControllerOverride of the views that don't have the original animation (the smiling/winking). The problem is that the project is now getting pretty large with lots of characters and views, and so adding any of these unique-animations means I have to go to every single ControllerOverride of every viewing-angle of each character and insert their Empty Animations.

Is there a way that I could simply set up the SkeletonMecanim to do nothing (not play any animation) if it tries to play an Animation that it doesn't have?

Or maybe another thought would be (on Awake()) to scan through the list of animations in the ControllerOverrides and insert the Empty Animations in there as-needed so I don't have to manually do it? :think:
User avatar
Jamez0r
  • Posts: 194

Harald

Are you using the latest spine-unity unitypackage? We have very recently added null-checks to cope with any empty or non-Spine animations in the controller.
User avatar
Harald

Harri
  • Posts: 2075

Jamez0r

Thanks Harald, I'll check! It's for my side project so I'm not the person that added the package :'(
User avatar
Jamez0r
  • Posts: 194


Return to Unity