Move a portrait

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Wiik
Posts: 12
Joined: Mon Nov 01, 2021 3:52 pm

Move a portrait

Post by Wiik »

Hi,
I have a classic visual novel dialogue and i'd like the characters portrait to leave the scene (from the right or the left).
What would be the easiest way to achieve that ?

I've tried to add a new animation with a trigger "GoLeft" to the animator Canvas Group Animator Controller which is on a Subtitle Panel. In the Sequence of my Dialogue Entry i typed this : "AnimatorTrigger(GoLeft,Speaker)". Unity told me this error : "no animator found on Speaker".

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

Re: Move a portrait

Post by Tony Li »

Hi,

The error is because AnimatorTrigger() is trying to control an Animator on the speaker GameObject, not the character portrait. If you don't specify a GameObject, it will use the speaker GameObject.

Here are three different suggestions: (You can take your pick of which one fits your project best.)

1. If you use animated portraits, add a exit left and/or exit right animations to your character's portrait animator controller. Use the AnimatorPlay() sequencer command to play the animations.

2. Or set up a subtitle panel for each character. Configure the Open and Close animations to move the character onto the screen and off it, respectively.

3. Or don't use dialogue UI portraits at all. Instead, make the characters' images their own GameObjects separate from the dialogue UI. Then you can do whatever you want with them.
Wiik
Posts: 12
Joined: Mon Nov 01, 2021 3:52 pm

Re: Move a portrait

Post by Wiik »

Thanks Tony,
i went with option 2 for now. It works better when the correct GameObject is specified indeed :lol:

Now my character leaves the scene but then comes back briefly before the dialogue closes.
I think it may be because of the default behavior that make the animation 'Hide' plays, but 'Hide' only changes the alpha of the canvas (so why does my character comes back into the scene before hiding?).

Also how can i make so the player have to press the continue button between 2 sentences of the same dialogue entry ?
I've tried to make a child node with the same actor, but then the portrait goes in Unfocus state before coming back in Focus.
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Move a portrait

Post by Tony Li »

Hi,
Wiik wrote: Tue Nov 02, 2021 6:13 amNow my character leaves the scene but then comes back briefly before the dialogue closes.
I think it may be because of the default behavior that make the animation 'Hide' plays, but 'Hide' only changes the alpha of the canvas (so why does my character comes back into the scene before hiding?).
You can change the Hide animation to keep the portrait off the screen.
Wiik wrote: Tue Nov 02, 2021 6:13 amAlso how can i make so the player have to press the continue button between 2 sentences of the same dialogue entry ?
I've tried to make a child node with the same actor, but then the portrait goes in Unfocus state before coming back in Focus.
Split them into two nodes. Set the subtitle panel's Visibility to Until Superceded.
Wiik
Posts: 12
Joined: Mon Nov 01, 2021 3:52 pm

Re: Move a portrait

Post by Wiik »

You can change the Hide animation to keep the portrait off the screen
How do i do that ?
Sry if it's a newb question but i don't understand why the Subtitle Panel comes back into the scene since the 'hide' animation only adjust the canvas alpha.
Set the subtitle panel's Visibility to Until Superceded.
It doesn't work. The next dialogue entry is cut and the game is frozen.
Btw after other tests, the default visibility 'Always once Shown' works fine. The character only goes unfocused when the 1st node is a Response Menu.
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Move a portrait

Post by Tony Li »

Hi,

It sounds like your animator is trying to play the unfocus and hide animations when the dialogue UI closes.

You can adjust your animator controller to prevent that. Here's an example:

DS_VNHidePortraitExample_2021-11-02.unitypackage

Play the third conversation: Albert. After a few lines, Albert and Abby will go offscreen. Then Albert will reappear, but Abby will stay offscreen.

To set up the animator controller, I added a bool parameter named "Offscreen". The transitions from Any State to Show or Hide require Offscreen to be false.

The conversation sets the Offscreen parameter true when Abby and Albert leave. Then it sets the Offscreen parameter false to make Albert reappear.
Post Reply