How To: Animate Portrait Images

Announcements, support questions, and discussion for the Dialogue System.
lcn_mc
Posts: 57
Joined: Wed Jun 29, 2022 1:56 pm

Re: How To: Animate Portrait Images

Post by lcn_mc »

Thanks, Tony. I'll have some stuff together for you before the end of tomorrow, along with that new post. Today got away from me, unfortunately.
lcn_mc
Posts: 57
Joined: Wed Jun 29, 2022 1:56 pm

Re: How To: Animate Portrait Images

Post by lcn_mc »

Tony,

The project has been sent via email. I've got one animated portrait-related question, which I'll post here, and some other 'best practices' questions for which I'll make a separate thread.

In looking at the Animated Portrait Example project, it's not clear to me where/how the animations for each of the wizards (Yellow/Green/Red) were created. (For instance, if you open the animation window and click on the various Game Objects for each of the wizards, there's no associated animations as the animation window prompts you to create an Animation Clip to begin animating the Game Object. So, where/how did you create the various animations for each of the wizards?

(e.g.: Create a game object, add an Image component to it, create animations from that, save the animations, then delete the game object?)

The first step in the Animated Portraits section of the manual says to prepare animation clips that animate the Image component of a Game Object, but it's never been really clear to me what Game Objects I should be using for that creation process in this instance. Any insight you could provide there would be very appreciated.
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: How To: Animate Portrait Images

Post by Tony Li »

Hi Lucian,

Thanks for sending your repro project. I replied to your email, and I'm following up here. The scene looks correct to me. What should I be looking for? Would you please remind me what was going wrong? I played Scene_01, and CHAR_DebugAnimTester appears to be talking correctly.
lcn_mc
Posts: 57
Joined: Wed Jun 29, 2022 1:56 pm

Re: How To: Animate Portrait Images

Post by lcn_mc »

Tony,

Sorry if I wasn't clear in my mail. What I meant was that if you launch the scene (which should go immediately into the conversation named 'DEBUG_TestConvo03' with CHAR_DebugAnimTester as the conversant), the CHAR_DebugAnimTester character doesn't animate during the conversation. I looked at the Source Image being used (by expanding the created-in-scene Dialogue Manager (beneath the 'DontDestroyOnLoad' parent in the Hierarchy) for its Subtitle Panel/Portrait Image, and it never changes from Idle to Talking.

The conversation is using Sequence Commands to send the 'play the talk animation' instruction, but nothing seems to animate.

Hope that clarifies.
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: How To: Animate Portrait Images

Post by Tony Li »

Hi,

Did you receive my email? I included a screenshot (also pasted below) that shows CHAR_DebugAnimTester being animated. What am I missing? Below, you can see that the character has assigned its animator controller to the Portrait Image, and the image is showing the open mouth sprite that's part of the animation:

CHAR_DebugAnimTester.png
CHAR_DebugAnimTester.png (117.62 KiB) Viewed 1066 times
lcn_mc
Posts: 57
Joined: Wed Jun 29, 2022 1:56 pm

Re: How To: Animate Portrait Images

Post by lcn_mc »

Tony,

Apologies; I did see your mail with the screenshot. I meant that, when I run it locally, my version, for whatever reason, does not animate; despite it being the same project files and such that were sent. As mentioned, unlike in your example projects with Animated Portraits where you can see the Source Image change (from idle to talking) if you investigate the Portrait Image part of the Dialogue Manager's hierarchy during gameplay, the portrait image in my version of this project I sent you doesn't seem to change. (Which tells me, for whatever reason, it's not being told to animate.)

Very strange. Can you think of any explanation for this kind of discrepancy between what you're seeing and what I'm seeing? Maybe some kind of setting in the Unity project somewhere that wouldn't have been exported as part of the project reproduction files I sent through?
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: How To: Animate Portrait Images

Post by Tony Li »

Hi,

Are there any errors or warnings in the Console window when you play?

I just noticed that your subtitle panels' Portrait Image GameObjects all have the same name. This is fine, but keep in mind that the AnimatorPlay() sequencer command works by GameObject name. The most likely explanation is that AnimatorPlay() is operating on the wrong "Portrait Image" GameObject. Change your Sequence from this:

Code: Select all

AnimatorPlay(Talk, Portrait Image);
AnimatorPlay(Idle, Portrait Image)@{{end}}
to this:

Code: Select all

AnimatorPlay(Talk, speakerportrait);
required AnimatorPlay(Idle, speakerportrait)@{{end}}
This will use the special keyword 'speakerportrait' which refers unambiguously to the speaker's Portrait Image, regardless of what they're named.

(Side note: The 'required' keyword guarantees that AnimatorPlay(idle, speakerPortrait) plays even if the player skips ahead before the {{end}} duration is reached.)
lcn_mc
Posts: 57
Joined: Wed Jun 29, 2022 1:56 pm

Re: How To: Animate Portrait Images

Post by lcn_mc »

Tony,

Aha! That seems to have been the culprit. When going through the tutorials for animated portraits, I had been referring to the game object name and not using the special keywords (like 'speakerportrait'). I assume that having multiple game objects named 'Portrait Image', such as in each Subtitle Panel, was where the sequencer was getting confused; so, despite the syntax being correct and not throwing errors or warnings in the log (even when the reporting was set to 'Info'), it was never actually talking with the correct game object.

Whew. Well, lesson learned. I would also certainly suggest adding a note about the special keywords stuff to the manual's section on Animated Portraits; could save someone down the line a bit of time (and you, some forum posts) if that helpful tip is appended there as a note.

Many thanks for your patience and assistance here during the back and forth!
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: How To: Animate Portrait Images

Post by Tony Li »

Glad to help! I'll review that manual section.
Post Reply