Page 1 of 2
Animator Controller not set on custom portrait images
Posted: Fri Jan 31, 2020 10:08 pm
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?
Re: Animator Controller not set on custom portrait images
Posted: Fri Jan 31, 2020 11:15 pm
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.
Re: Animator Controller not set on custom portrait images
Posted: Mon Feb 03, 2020 2:58 pm
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?
Re: Animator Controller not set on custom portrait images
Posted: Mon Feb 03, 2020 3:15 pm
by Tony Li
Hi,
Would it be possible for you to send a reproduction project to tony (at) pixelcrushers.com?
Re: Animator Controller not set on custom portrait images
Posted: Tue Feb 04, 2020 2:20 pm
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?
Re: Animator Controller not set on custom portrait images
Posted: Tue Feb 04, 2020 2:52 pm
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.
Re: Animator Controller not set on custom portrait images
Posted: Tue Feb 04, 2020 3:01 pm
by VoodooDetective
Oh awesome! Thanks! I just finished a repro in case it's needed.
Re: Animator Controller not set on custom portrait images
Posted: Tue Feb 04, 2020 3:06 pm
by Tony Li
Yes, that would be great. Would you please send it to tony (at) pixelcrushers.com?
Re: Animator Controller not set on custom portrait images
Posted: Tue Feb 04, 2020 3:23 pm
by VoodooDetective
Alrighty, just sent. Let me know if it doesn't show up and I'll retry. Thanks for all your help!
Re: Animator Controller not set on custom portrait images
Posted: Tue Feb 04, 2020 3:28 pm
by Tony Li
Just got it. Thanks! When I put the patch together later today, I'll check it with your repro project.