Animator Controller not set on custom portrait images

Announcements, support questions, and discussion for the Dialogue System.
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Animator Controller not set on custom portrait images

Post by VoodooDetective »

Here's what I did:

1) duplicated the PC Subtitle Panel
2) added it to the Standard Dialogue UI
3) made sure the "use animated portraits" was ticked on the new subtitle panel
4) made sure the portrait image reference was set in the new subtitle panel
5) made sure the portrait image had an animator on it

When I play a conversation that sets the portrait image animator talking, I get an error saying the animator doesn't have the animator controller set. Sure enough, I paused the game and looked at the instance of the new subtitle panel to find the animator didn't have a controller set.

Apologies in advance if this is a dumb question. I'm assuming I just missed a step?
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Animator Controller not set on custom portrait images

Post by Tony Li »

Hi,

Add a Dialogue Actor to the character's GameObject. Assign the animator controller to it.

It's a bit obscure, but this process allows multiple characters to use the same Animator component on the subtitle panel's portrait image.
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Re: Animator Controller not set on custom portrait images

Post by VoodooDetective »

Oh shoot! I meant to add that as #6. That's something else that I did. Could there be another step missing too?
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Animator Controller not set on custom portrait images

Post by Tony Li »

Hi,

Would it be possible for you to send a reproduction project to tony (at) pixelcrushers.com?
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Re: Animator Controller not set on custom portrait images

Post by VoodooDetective »

I'll try to throw that together today. One thing I did notice in the code as I was stepping through was this:

Code: Select all

        public void CheckSubtitleAnimator(Subtitle subtitle)
        {
            if (subtitle != null && useAnimatedPortraits && animator != null)
            {
                var dialogueActor = DialogueActor.GetDialogueActorComponent(subtitle.speakerInfo.transform);
                if (dialogueActor != null && dialogueActor.standardDialogueUISettings.portraitAnimatorController != null)
                {
                    var speakerPanelNumber = dialogueActor.GetSubtitlePanelNumber();
                    var isMyPanel = (PanelNumberUtility.GetSubtitlePanelIndex(speakerPanelNumber) == this.panelNumber) ||
                        (speakerPanelNumber == SubtitlePanelNumber.Default && subtitle.speakerInfo.isNPC && isDefaultNPCPanel) ||
                        (speakerPanelNumber == SubtitlePanelNumber.Default && subtitle.speakerInfo.isPlayer && isDefaultPCPanel) ||
                        (speakerPanelNumber == SubtitlePanelNumber.Custom && dialogueActor.standardDialogueUISettings.customSubtitlePanel == this);
                    if (isMyPanel)
                    {
                        StartCoroutine(SetAnimatorAtEndOfFrame(dialogueActor.standardDialogueUISettings.portraitAnimatorController));
                    }
                }
            }
        }
I'm using [panel=2] to make it use my custom panel, so the "speakerPanelNumber" is always "Default" and as a consequence, isMyPanel is always false.

Is there somewhere else the [panel=2] is accounted for, or is that missing?
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Animator Controller not set on custom portrait images

Post by Tony Li »

That looks like an edge case that isn't accounted for. I'll try to post a patch here by the end of the day.
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Re: Animator Controller not set on custom portrait images

Post by VoodooDetective »

Oh awesome! Thanks! I just finished a repro in case it's needed.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Animator Controller not set on custom portrait images

Post by Tony Li »

Yes, that would be great. Would you please send it to tony (at) pixelcrushers.com?
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Re: Animator Controller not set on custom portrait images

Post by VoodooDetective »

Alrighty, just sent. Let me know if it doesn't show up and I'll retry. Thanks for all your help!
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Animator Controller not set on custom portrait images

Post by Tony Li »

Just got it. Thanks! When I put the patch together later today, I'll check it with your repro project.
Post Reply