arcbox

  • Oct 31, 2023
  • Joined May 12, 2022
  • Sorry about being vague, I guess from my perspective I'm using such a small portion of the API that it seems very simple but you don't have the same context so that wasn't very helpful of me.

    I start off by setting an idle animation for the character, using the AnimationState.SetAnimation method:
    skeletonAnimation.state.SetAnimation(0, "idle" true);

    Then, at some point that is triggered by the player we replace that idle with a one-time animation, and return back to the idle animation afterward. The animations have been close enough that we haven't needed to do any mixing:
    skeletonAnimation.state.SetAnimation(0, "action", false);
    skeletonAnimation.state.AddAnimation(0, "idle", true, 0);

    What is happening is that when the first idle switches to the action animation it is showing one frame of a sprite turned on at full scale when the artist has done everything to ensure that sprite is hidden in the first frame of the action animation. The sprite immediately tweens down to the scale and opacity the artist has set, rather than being that way from the beginning.

    Here is the example, you can see the question marks are immediately visible, and then tween down. They are supposed to start at no scale and tween up based on how the animation is setup in Spine.

    Thank you for your time, and let me know if I can provide any additional detail.

    • Hey, dev here.

      The animation in question was being started after the .Complete callback was fired from a previous idle animation. I was using the AnimationState.SetAnimation method to do so both in that callback and for the original animation.

      I just tried using the AddAnimation method to see if queueing it up that way would avoid the problem, and it improved it quite a bit, though it isn't perfect.

      Is there somewhere I can learn more about setting animations in the appropriate time in the Unity update cycle? I assumed queueing them up using the AddAnimation would be an appropriate method.

      • Sure, I'm just using the Material.SetColor method, as follows:

        mat.SetColor("_Color", Color.white)

        And I'm calling that function in a tween where the brightness of the color is adjusted to produce the glowing effect:

        DOTween.To(x => mat.SetColor("_Color", Color.white.AdjustBrightness(x)), 1, 0.8f, 0.75f)

        Is that problematic?

      • In subsequent testing we have been able to resolve the issue by removing all instances of toggling any images on/off within the animation.

        This isn't a great solution because our animations toggle images on/off all the time, but I hope this provides further insight into a solution.

      • Our game is a city building where you can pick up objects to move them around.

        When you pick up an object, we animate the material's tint colour to have a flashing effect that indicates the object is picked up. We are using the Skeleton Tint shader, and updating the "_Color" property to do this.

        This mostly works well. When I pick up most objects the material changes to an instance material and the colour tinting happens properly.

        However, for some objects that animate the material is constantly swapping back and forth between the instance material and the shared material, which breaks the tinting. I've tried forcing it to stay as the instance material in several ways, but it seems like something on Spine's side is forcing it back to the shared material, and this seems directly related to the animation in some way.

        Is there something that would cause that behaviour?

        I've uploaded a video showing how the material is swapping when the object is picked up

        Thanks!

      • Hello,

        I've implemented the mix and match example and am building skins dynamically based on the player selection. When using the SkeletonAnimation in a scene, everything works perfectly. However, I also want to display characters on the UI in a profile screen, and so I have used the same implementation with SkeletonGraphic and I am experiencing very strange results.

        Prior to setting the dynamically created skin, the skeleton looks like it does in the editor. But then once I assign the new skin several pieces of the character shift in their position. I've tried deleting and recreating the SkeletonGraphic, re-importing, etc. The only thing that changes is that different pieces of the character shift around. One time the hand was floating above the head. Right now, the shoes are detached from the character.

        In the attachments below, you can see the version in the editor where the shoe is attached properly, and what I'm seeing once I dynamically create the skin in-game. It also looks like the draw order is different on the SkeletonGraphic version, as you can see the seams on the pants that should be hidden like they are in the last attachment.

        Any assistance would be greatly appreciated!