• Unity
  • PLAYMAKER Integration

Hey,

This seems great, looking for a little advice though.
(Classic n00b warning - I'm super new to PlayMaker).

Is there a way to chain animations through PlayMaker? Meaning one after the other, my goal is to have a series of animations play and then fire a Complete Event.

I'm also wondering if there is a way to grab a random spine animation through PlayMaker? I could use a sendMessage to call a function - but that would just lead me to setting the animation through code (like I would normally).

Thanks for the help - sorry for starting a thread within a thread - PM holds some great possibilities with Spine.

r2c

Related Discussions
...
3 months later

hello... sorry for late reply... is you can chain your animations in playmaker.
and also yes... not so hard to use SendRandomEvent action from playmaker and set your animation


guys I'm working on SpineSlotAction so that you can set attachments, color or disable or enable attachment.

You need more actions to control your spine animations in Playmaker? Please write here.

3 months later

This is cool, but it won't work with variables at the moment. So if you need to control multiple objects that animate from one FSM you cannot.

2 months later
foriero wrote

hello... sorry for late reply... is you can chain your animations in playmaker.
and also yes... not so hard to use SendRandomEvent action from playmaker and set your animation


guys I'm working on SpineSlotAction so that you can set attachments, color or disable or enable attachment.

You need more actions to control your spine animations in Playmaker? Please write here.

That sounds excellent, are you still updating this? I'd love to give it a whirl in my next project.

2 months later

Hiya, this is really great to see the Playmaker Integration however for some reason I can't get it working... ๐Ÿ™

I've put the various scripts in the Playmaker Action and Editor folders but somehow I get the following messages.

Assets/PlayMaker/Actions/Editor/SpineActionEditor.cs(23,21): warning CS0168: The variable `action' is declared but never used

Assets/PlayMaker/Actions/Editor/SpineAnimationActionEditor.cs(44,71): error CS0021: Cannot apply indexing with [] to an expression of type `Spine.ExposedList<Spine.Animation>'

Any ideas how I can sort this out?

Thanks a lot. :-)

a month later

Hi Ive come late to this as well, and im getting the same error as John above? Whats the best way to fix this.

Thanks

How to install your action events? It does not show up in playmaker yet.


19 Nov 2015, 11:47


Foriero, I have imported the .cs only and can access some features. However I do not understand all the actions and their implications. An explanation/video about how to install your code and how to use it in Unity would be ab-so-lu-te-ly fantastic!

A fan ๐Ÿ˜‰

a month later

Hey there I also have the same error as John and was wondering if you've looked into it? This is exactly what i need to finish my project and it would be very appreciated ๐Ÿ™‚

Hi guys,

I also run into this problem and made a patch until the author makes his own fix.
Just overwrite the original files in "Editor" folder with corresponding ones in the attached file.

Cheers

9 days later

Okay I've edited this comment way too much but. I've figured out a way to implement animation blending:
In the SpineAnimationAction, I added this:
[Tooltip("")]
public int i;

and then i changed the value '0' on the AddAnimation, SetAnimation and ResetAnimation inside the
'public override void OnEnter()' to an 'i'. Like this:

skeleton.state.SetAnimation(i, animationName, loop.Value);

And lastly, in the SpineAnimationActionEditor I added EditField("i");.
With this, the action will have 1 extra visible variable, namely 'i'. this represents to what type the animation belongs. When Spine animations belong to different groups, they can blend with each other, otherwise you will get one animation running while the other is there, but just not playing.

I hope this helps somebody ๐Ÿ™‚

IMPORTANT: this fsm action is kind of weird when you change the code. the 'Animation' field disappears when you change the code, so do the following:

Before changing the code:

  • add a SpineAnimationAction to a playmaker FSM, and select the 'Animation' tab and choose your appropriate animation.
  • Test it to see if it works.

If it worked:

  • Change the scripts as mentioned above.
  • check your SpineAnimationAction in your fsm action and check if 'i' is there. By now you might have noticed that the 'Animation' tab has disappeared.
  • Test again, you will see the animation play even though the tab had disappeared!
  • Check your playmaker fsm, for some reason, the 'Animation' tab is back. Now you can work normally again.
    I don't know what causes this. there's a chance you might not have this but regardless, try it out just in case. otherwise you will have to reimport the download file and the patch file.
17 days later

Hey CrispyArrow or anyone that has tried this out. How does the blend work? I added the code into the action but I dont know what you mean by

When Spine animations belong to different groups, they can blend with each other

Can you help me out in explaining this a bit more?

EDIT: I also converted the Spine sprite attacher script by Mitch to playmaker and is attached.

6 months later

Hi everyone:

I have just started using unity and playmaker. I tried to install the scripts and I got an error as well. Any updates on any of this or further integration of spine and playmaker?
I am trying to find out how I can create animation files from the animations that are under the Spine_SkeletonData and bring it into the Animator editor.

cheers
Bez

2 years later
foriero wrote

Thanks Spiral, I will look into Mitch's implementation. In the meantime I did create new action and cleaned a bit the old ones. The new one is called SpineEventConditionAction.cs. Just set your condition on what you want to react and you are good to go.


Please download actions from initial post of this thread.

have a question for you, how to implement a script for Animation Event. For example, in Spine2d on the desired animation, I created an event for example "Wrong" and I want to be sent to SendEvent on detection. I nowhere to find examples related to Spine in Animator. I found one method, but it's a little different, jy defines the end of the animation but it does not work correctly, below I can apply this script can be useful.
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{

[ActionCategory("Artix")]
[Tooltip("Artix Production")]
public class SendEventEndAnimation : FsmStateAction
{

    [RequiredField]
    [CheckForComponent(typeof(UnityEngine.Animator))]
    [Tooltip("The GameObject to be observed.")]
    public FsmOwnerDefault gameObject;

    [RequiredField]
    [Tooltip("Send this event when animation finished.")]
    public FsmEvent sendEvent;

    [RequiredField]
    [Tooltip("The name of the animation to be observed.")]
    public FsmString animationName;

    private Animator animator;

    public override void Reset() {
        gameObject = null;
        sendEvent = null;
        animationName = null;
    }

    // Code that runs on entering the state.
    public override void OnEnter() {
        var go = Fsm.GetOwnerDefaultTarget(gameObject);
        animator = go.GetComponent<Animator>();
    }

    // Code that runs every frame.
    public override void OnUpdate() {
        var a = animator.GetCurrentAnimatorStateInfo(0);
        if (a.IsName(animationName.Value) && a.normalizedTime >= 0.98f) {
            Fsm.Event(sendEvent);
        }
    }
}

}

a year later

Is this thread still alive? I want to use playmaker with Spine, but I don't know if many years later this actions works nowadays.

You can have a look at these forum threads regarding playmaker integration:
PLAYMAKER
Spine - Unity - Playmaker / Quick Tip

15 days later

I think the actions are working. If not let me know. We are still here and using them everyday. :-)

5 months later

Hi.
Here says 'no overload methods for Sa_State_Event corresponds to the delegate AnimationEvent.TrackEntryEventDelegate'

EDIT: There are other 30 errors of the same type spread on the others scripts

It looks as if your Playmaker integration is not compatible with the spine-unity runtime version you are using.
Which Playmaker integration and which version of the spine-unity runtime are you using?