Playing Animations on Dialogue Nodes
Playing Animations on Dialogue Nodes
I'm currently trying to implement some animations during dialogue - specifically inside the nodes (image 1).
The problem is, the animations either don't play or I get this error message (image 2)
What am I doing wrong and how can I play the animations?
The problem is, the animations either don't play or I get this error message (image 2)
What am I doing wrong and how can I play the animations?
- Attachments
-
- Captura de Tela (202).png (7.48 KiB) Viewed 1504 times
-
- Captura de Tela (201).png (13.68 KiB) Viewed 1504 times
Re: Playing Animations on Dialogue Nodes
Hi,
That means the subject's Animator doesn't have a state named "FallLeft".
Temporarily set your Dialogue Manager's Other Settings > Debug Level to Info.
When the conversation gets to that node, the Dialogue System will log 2 messages to the Console window. The first message shows what the sequencer has parsed. Something like:
Dialogue System: Sequencer: Play( AnimatorPlay(FallLeft)@0 )
The second message shows what GameObject is being used as the subject. Example:
Dialogue System: Sequencer: AnimatorPlay(FallLeft, NPC_X)
Make sure it's the correct GameObject. See Character GameObject Assignments for more info.
That means the subject's Animator doesn't have a state named "FallLeft".
Temporarily set your Dialogue Manager's Other Settings > Debug Level to Info.
When the conversation gets to that node, the Dialogue System will log 2 messages to the Console window. The first message shows what the sequencer has parsed. Something like:
Dialogue System: Sequencer: Play( AnimatorPlay(FallLeft)@0 )
The second message shows what GameObject is being used as the subject. Example:
Dialogue System: Sequencer: AnimatorPlay(FallLeft, NPC_X)
Make sure it's the correct GameObject. See Character GameObject Assignments for more info.
Re: Playing Animations on Dialogue Nodes
Thanks for the quick reply, as always!
The messages display as intended and the subject does have a state called "FallLeft" in the Animator. But the animation doesn't play. I found out that by using AnimatorPlayWait, the animation does play, but only for a split second.
Could it be some Animator configuration, maybe?
The messages display as intended and the subject does have a state called "FallLeft" in the Animator. But the animation doesn't play. I found out that by using AnimatorPlayWait, the animation does play, but only for a split second.
Could it be some Animator configuration, maybe?
Re: Playing Animations on Dialogue Nodes
Yes. Almost certainly, the FallLeft state has a transition that's firing as soon as the animator enters the FallLeft state. Check the conditions on that transition arrow. You may need to either remove the transition arrow or an additional sequencer command such as AnimatorBool() to prevent it from immediately transitioning away from FallLeft.
Re: Playing Animations on Dialogue Nodes
I see. I did as you suggested and managed to find a workaround.
This is because of the way our Animator is set up - all states are linked to Any State and have Fixed Duration ticked on. All of these states are actually Blend Trees that contain the different Animations (the different nodes you see without any transitions).
So the workaround works fine, but is there another option? Maybe a small rework I could do to the Animator so I don't need to set up several different Animation Bools just to get the animation to play? What would you reccommend?
This is because of the way our Animator is set up - all states are linked to Any State and have Fixed Duration ticked on. All of these states are actually Blend Trees that contain the different Animations (the different nodes you see without any transitions).
So the workaround works fine, but is there another option? Maybe a small rework I could do to the Animator so I don't need to set up several different Animation Bools just to get the animation to play? What would you reccommend?
Re: Playing Animations on Dialogue Nodes
Hi,
The animator controller is a state machine, and by nature state machines have transitions. That's how they automatically change states. You could change the parameters that affect the transitions -- for example, add an isInDialogue bool parameter, and make all Any State transitions require that the bool is false. Or you might find it easier to remove the Any State transitions and have transitions from state to state. Then you can add separate states for dialogue (e.g., WalkLeftCutscene).
The animator controller is a state machine, and by nature state machines have transitions. That's how they automatically change states. You could change the parameters that affect the transitions -- for example, add an isInDialogue bool parameter, and make all Any State transitions require that the bool is false. Or you might find it easier to remove the Any State transitions and have transitions from state to state. Then you can add separate states for dialogue (e.g., WalkLeftCutscene).
Re: Playing Animations on Dialogue Nodes
It worked! We set up our Playmaker FSMs in a different way and made new, Dialogue-specific Animator nodes without any transitions, as you said. Then we just call the FSM Event through the Dialogue Node.
Thanks for the help!
Thanks for the help!
Re: Playing Animations on Dialogue Nodes
Great! Glad to help.
-
- Posts: 111
- Joined: Mon Apr 08, 2019 8:01 am
Re: Playing Animations on Dialogue Nodes
Hey Tony,
Sorry for hijacking this thread. I've run into a similar issue and followed the steps that Strig and you laid out earlier. In my case, AnimatorPlayWait didn't work out for me.
Here's my Debug Info window:
I've already removed any transitions from the Receptionist Back state like so:
The state is a single frame as it's a still image I'm experimenting with for now. The idea is that it's supposed to be held for 2.5 seconds, hence the delay sequence right after.
Would you have any other ideas on how to fix this?
Thanks premptively for your help, and hope you had a safe and happy New Years :0
Sorry for hijacking this thread. I've run into a similar issue and followed the steps that Strig and you laid out earlier. In my case, AnimatorPlayWait didn't work out for me.
Here's my Debug Info window:
I've already removed any transitions from the Receptionist Back state like so:
The state is a single frame as it's a still image I'm experimenting with for now. The idea is that it's supposed to be held for 2.5 seconds, hence the delay sequence right after.
Would you have any other ideas on how to fix this?
Thanks premptively for your help, and hope you had a safe and happy New Years :0
Re: Playing Animations on Dialogue Nodes
Hi,
If you inspect that GameObject and keep an eye on the Animator window, does it transition into that state?
You may need to add a second frame with the same keyframe values.
Also, since you're waiting 2.5 seconds, you can use AnimatorPlay(). If you want to go back to idle after, you can use @time:
If you inspect that GameObject and keep an eye on the Animator window, does it transition into that state?
You may need to add a second frame with the same keyframe values.
Also, since you're waiting 2.5 seconds, you can use AnimatorPlay(). If you want to go back to idle after, you can use @time:
Code: Select all
AnimatorPlay(Receptionist Back, Receptionist);
required AnimatorPlay(Receptionist Idle, Receptionist)@2.5