Unable to control the listener's animator.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
2gold
Posts: 19
Joined: Wed Aug 18, 2021 2:56 am

Unable to control the listener's animator.

Post by 2gold »

* This article was written through a translator.
Hello, I bought and use Dialogue System Asset.
Thank you for creating a powerful and easy tool.

I made Animated Portrait, and it works well.
But there is one problem.

1. Create an NPC node in GameObject and attach the Dialogue Actor script. Next, you connected the animator to the Portrait Animator Controller entry.

2. In the Conversations section, I put the following script in the NPC's Sequence item.

Code: Select all

AnimatorPlay(Talk,Photo_NPC0);
AnimatorPlay(Idle,Photo_NPC0)@{{end}}
Now the NPC's mouth moves while the NPC's lines are being spoken, and stops when the lines are finished.

3. However, if the player's lines are played by pressing the Continue button while the NPC's mouth is moving, the NPC's mouth will not stop forever! (This is because the NPC node's animator continues to play in Talk state.)
error.gif
error.gif (240.29 KiB) Viewed 503 times
*The left character has started his lines, but the right character can't stop talking.

Is there any way to reset the state of the animator when another character starts a dialogue while the animator is playing?
I tried something like AnimatorPlay(Npc,Talk,Photo_NPC0) in the Player's Sequence, but it didn't work. :(

I hope the question is well understood.
thanks!
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Unable to control the listener's animator.

Post by Tony Li »

Hello,

Use the 'required' keyword:

Code: Select all

AnimatorPlay(Talk,Photo_NPC0);
required AnimatorPlay(Idle,Photo_NPC0)@{{end}}
This guarantees that AnimatorPlay(Idle,Photo_NPC0) will run.
2gold
Posts: 19
Joined: Wed Aug 18, 2021 2:56 am

Re: Unable to control the listener's animator.

Post by 2gold »

I applied it to the Node before the Actor transitioned and it works great!
Thanks for your help!
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Unable to control the listener's animator.

Post by Tony Li »

Glad to help!
Post Reply