Page 1 of 1

Questions about animated portrait images

Posted: Thu Aug 18, 2022 3:19 pm
by Tony Li
Carrying over from YouTube:
Hey. Thank you for this great video. I have some questions wrt to the animated sprites because it does not seem to work on my side. I have added a dialgoue actor component to the character and also verified that the animation controller is set when talking. So far it works fine. I have added two animations to the controller (Idle and Talk as in the example). And I have verified that the animation controller is actually used during the conversation. It seems that the state is always Idle and never switches to state Talk. Is there anything else I need to do? How is the state actually changed in code? i could not find the line in the code but knowing that might possibly help me figure out why the state is not changed. Thank you in advance.
Hi! We have a newer series of dialogue UI tutorials here:
However, they don't yet cover animated portraits. Animated portraits are covered in the manual here: https://www.pixelcrushers.com/dialogue_ ... dPortraits
Use AnimatorPlay() and/or AnimatorPlayWait() sequencer commands to control the portrait's animator controller. Take advantage of the keywords 'speakerportrait' and 'listenerportrait', which refer to the current dialogue entry's speaker and listener Portrait Images (the GameObjects that have the portrait animators). For example, to make the speaker play the Talk animation and then stop, use something like:

Code: Select all

AnimatorPlay(Talk, speakerportrait);
required AnimatorPlay(Idle, speakerPortrait)@Message(Typed)[
If you'd like more details or have follow-up questions, please feel free to post on the forum: https://pixelcrushers.com/phpbb/
Shouldn’t the animation automatically work when having activated „UseAnimatedSprites“. Why use own sequencers command for that? And would I have to add that in every dialog node then? Isn’t that a hell of work? Or am I missing something?
Yes, it should work like a regular animator. If the actor's portrait animator controller's default state plays an animation, it should play that animation without you having to specify anything. However, typically you'll want to start and stop animations (e.g., talk then idle), otherwise the character may keep flapping its mouth even when the conversation progresses to a different character.

You don't have to add it to every dialogue entry node. You can set the Dialogue Manager GameObject's Display Settings > Camera & Cutscene Settings > Default Sequence or the conversation's Conversation Properties > Override Display Settings > Default Sequence. For example, you could set it to something like:

Code: Select all

AnimatorPlay(Talk, speakerportrait);
required AnimatorPlay(Idle, speakerportrait)@{{end}}
Then leave the dialogue entry nodes' Sequence fields blank, or include the keyword {{default}} in the Sequence field, and it will automatically play the Default Sequence.

Re: Questions about animated portrait images

Posted: Thu Aug 18, 2022 3:34 pm
by klausweber91
Thank you so much. That has worked. Appreciate your support and always quick answers <3.

Re: Questions about animated portrait images

Posted: Thu Aug 18, 2022 3:38 pm
by Tony Li
Glad to help!