Play animation when NPC conversation node ends

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
undecode
Posts: 25
Joined: Mon Apr 13, 2020 3:53 pm

Play animation when NPC conversation node ends

Post by undecode »

Hi. I'm having some issues with this.

I'm using an Animator component for my NPC that has a fade-in animation on Entry status. This is working fine and whenever the NPC conversation node starts, it has a fade-in animation played.

The problem comes with the fade-out animation. Since it looks like the NPC portrait is immediately disabled when its node ends (and player one starts) I don't know where to play the fade-out animation.

I've read somewhere that you can play sequences when the conversation ends, but can't seem to find it. This would be handy to use the sequence command to play the fade-out animation. The problem with that approach (if it's possible), is that i'd need to use a sequence command in all NPC nodes?

RIght now my workaround is assign NPC portraits to my Player actor and make it play the fade-out animation on Entry status (different animator controller), but this is not good because if there are more than 1 NPC it'd be a mess. Also some entries conversant is a Narrator so it wouldn't play.

Any help with this is appreaciated.

Thanks in advance
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: Play animation when NPC conversation node ends

Post by Tony Li »

Hi,

You want the dialogue UI's PC & NPC portraits to fade in and out, correct?

Try using the Focus and Unfocus animation states. To see an example, assign the Focus Template Standard Dialogue UI prefab to your Dialogue Manager's Dialogue UI field. If that works similarly to the way you want, examine how the subtitle panels are set up. They use an animator controller that has Focus and Unfocus triggers as well as the usual Show and Hide triggers. Pay attention also to the Has Focus checkbox and OnOpen() UnityEvent.
undecode
Posts: 25
Joined: Mon Apr 13, 2020 3:53 pm

Re: Play animation when NPC conversation node ends

Post by undecode »

Hi Tony.

Yes, I've searched for this before and found the Focus template in another similar question on this forum. Gave it a try but found that Focus works different than the one I'm using (Mobile).

The problem I think is that Mobile disables the Portrait Image of the Subtitle Panel that isn't active (be NPC or PC). And since I have no PC portrait I just edited it to use the NPC Subtitle Panel and left the PC disabled. It works fine, but the only thing that is giving me a hard time is Fading out the portrait because it disables the Subtitle Panel.

Also, Focus is nice but:

1) The transition is instant, there is no ease in the fade out, just alpha going to 0.5
2) "They use an animator controller that has Focus and Unfocus". I don't see the animation controller? Just Portrait Image (Canvas Group) alpha 0.5 for OnOpen()
undecode
Posts: 25
Joined: Mon Apr 13, 2020 3:53 pm

Re: Play animation when NPC conversation node ends

Post by undecode »

Ok update:
That was fast... there is a check on the NPC Subtitle Panel.
Standard UI Subtitle Panel > UI Elements > Only Show NPC Portraits

This is exactly what I want, for the NPC Portrait image to not be disabled so I can use an animation controlled to fade it out.
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: Play animation when NPC conversation node ends

Post by Tony Li »

Is it working the way you want now?
undecode
Posts: 25
Joined: Mon Apr 13, 2020 3:53 pm

Re: Play animation when NPC conversation node ends

Post by undecode »

Yes, sorry... that wasn't very clear from my side haha, just a lot of mumbling.
Thanks Tony.
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: Play animation when NPC conversation node ends

Post by Tony Li »

All good! Glad it's working now.
Post Reply