Portrait animation

Announcements, support questions, and discussion for the Dialogue System.
mudukke
Posts: 73
Joined: Wed Sep 27, 2023 4:15 am

Portrait animation

Post by mudukke »

I have been watching the video Dialogue UI Tutorial 3 - Animated Portraits. However, I am struggling to add the sprites to the animation window do I need to create game objects for each sprite to add them on the animation window?

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

Re: Portrait animation

Post by Tony Li »

Hi,

If you haven't already downloaded and checked out the animated portraits example from the Dialogue System Extras page, I recommend doing that, too, so you can see how it works first-hand.

Here's how I recommend setting up animated portraits:

1. If your scene doesn't have a dialogue UI in it (e.g., as a child of the Dialogue Manager's Canvas), temporarily add one.

2. Inspect one of the subtitle panel's Portrait Image GameObjects.

3. Make sure it has an Animator component. (Your actual dialogue UI's subtitle panel should also have Animator components.)

4. Create an Animator Controller asset for your actor, and assign it to the Portrait Image's Animator component. This is just temporary, so you can create the animation(s) for the actor.

5. With the Portrait Image GameObject selected, open the Animation window (Ctrl+6) and create your animations. Example:

createPortraitAnimation.png
createPortraitAnimation.png (89.98 KiB) Viewed 1336 times

6. When you're done, you can unassign the Portrait Image's Animator component's Animator Controller field. The Dialogue System will set it at runtime.

7. Add a Dialogue Actor component to your actor's GameObject. Assign the actor's portrait Animator Controller to Dialogue UI Settings > Portrait Animator Controller.

8. To change animations, use regular sequencer commands with the special keyword speakerportrait. Example:

Code: Select all

AnimatorPlay(Talk, speakerportrait);
required AnimatorPlay(Idle, speakerportrait)@Message(Typed)
mudukke
Posts: 73
Joined: Wed Sep 27, 2023 4:15 am

Re: Portrait animation

Post by mudukke »

Since I have multiple characters do I need to create a portrait game object for each character
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Portrait animation

Post by Tony Li »

Only if you want to show multiple portraits (subtitle panels) at the same time.

When a character shows its portrait image, it will show it through a subtitle panel. You don't need to create a separate GameObject specifically for the character. At runtime, the dialogue UI will get the character's portrait image animator controller from the character's Dialogue Actor component and assign it to the subtitle panel's Portrait Image > Animator component.
mudukke
Posts: 73
Joined: Wed Sep 27, 2023 4:15 am

Re: Portrait animation

Post by mudukke »

I am using timelines to start dialogues. I have assigned the characters with the dialogue actors and assigned their portrait animators. However, when I press play to test it the portrait animation doesn't work. I have tested it out not using the timeline and the portrait animator works it doesn't seem to work in the timelines.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Portrait animation

Post by Tony Li »

Hi,

Can you assign the conversation's Actor to the timeline's Start Conversation track? And assign the Conversant to the StartConversationClip's Conversant field? This will ensure that it's using the intended Dialogue Actor and its portrait animator controller.

Here's an example of a conversation involving the Player as the conversation actor and Private Hart as the conversation conversant:
timelineAssignments.png
timelineAssignments.png (56.12 KiB) Viewed 501 times
mudukke
Posts: 73
Joined: Wed Sep 27, 2023 4:15 am

Re: Portrait animation

Post by mudukke »

This is working it shows the portrait animation however in the timeline when I use this example in the dialogue

AnimatorPlay(Talk, speakerportrait);
required AnimatorPlay(Idle, speakerportrait)@Message(Typed)

It doesn't go to the next dialogue node it gets stuck or completely jumps to a different dialogue node when I remove it, it goes to next dialogue node this only happens in the timeline

I am using override settings that don't show the continue button
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Portrait animation

Post by Tony Li »

Hi,

Does this:

Code: Select all

AnimatorPlay(Talk, speakerportrait);
required AnimatorPlay(Idle, speakerportrait)@Message(Typed)
show the correct Talk animation and then, when the typewriter is done, show the Idle animation?

If so, then does it just get stuck there and doesn't advance to the next dialogue entry?

For this conversation, are the dialogue entries' Sequence fields blank? Have you overridden the conversation properties and set the conversation's Default Sequence to the sequence above?
mudukke
Posts: 73
Joined: Wed Sep 27, 2023 4:15 am

Re: Portrait animation

Post by mudukke »

It plays the Talk animation but when typewriter is done, it doesn't show the Idle animation in the same dialogue node. Sometimes occasionally for some characters, it doesn't show the animation at all even though it has a as portrait animator attached.

yes some of the dialogue entries' Sequence fields are blank. I can send a reproduction because it concerns two different timelines ones looped and not looped and they behave differently when using this

AnimatorPlay(Talk, speakerportrait);
required AnimatorPlay(Idle, speakerportrait)@Message(Typed)
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Portrait animation

Post by Tony Li »

Hi,

Thanks for sending the reproduction project. I replied to you in email.
Post Reply