Animator Controller not set on custom portrait images
-
- Posts: 222
- Joined: Wed Jan 22, 2020 10:48 pm
Animator Controller not set on custom portrait images
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?
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
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.
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.
-
- Posts: 222
- Joined: Wed Jan 22, 2020 10:48 pm
Re: Animator Controller not set on custom portrait images
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
Hi,
Would it be possible for you to send a reproduction project to tony (at) pixelcrushers.com?
Would it be possible for you to send a reproduction project to tony (at) pixelcrushers.com?
-
- Posts: 222
- Joined: Wed Jan 22, 2020 10:48 pm
Re: Animator Controller not set on custom portrait images
I'll try to throw that together today. One thing I did notice in the code as I was stepping through was this:
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?
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));
}
}
}
}
Is there somewhere else the [panel=2] is accounted for, or is that missing?
Re: Animator Controller not set on custom portrait images
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.
-
- Posts: 222
- Joined: Wed Jan 22, 2020 10:48 pm
Re: Animator Controller not set on custom portrait images
Oh awesome! Thanks! I just finished a repro in case it's needed.
Re: Animator Controller not set on custom portrait images
Yes, that would be great. Would you please send it to tony (at) pixelcrushers.com?
-
- Posts: 222
- Joined: Wed Jan 22, 2020 10:48 pm
Re: Animator Controller not set on custom portrait images
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
Just got it. Thanks! When I put the patch together later today, I'll check it with your repro project.