Page 1 of 1

Get current portrait animator reference?

Posted: Thu Jun 17, 2021 12:40 am
by VoodooDetective
Is there an easy way to get the current portrait animator reference? Our game has portrait animators that'll be playing different facial animations based on the volume output from the voice channel.

Re: Get current portrait animator reference?

Posted: Thu Jun 17, 2021 8:20 am
by Tony Li
Hi,

If you know the subtitle panel, you can get the Animator component on the Portrait Image.

If you don't know the subtitle panel but you can a reference to a Subtitle object, you can use GetPanel:

Code: Select all

DialogueActor currentSpeakerDialogueActor;
var currentSubtitle = DialogueManager.currentConversationState.subtitle;
var ui = DialogueManager.dialogueUI as StandardDialogueUI;
var panel = ui.conversationUIElements.standardSubtitleControls.GetPanel(subtitle, out currentSpeakerDialogueActor);
var portraitAnimator = panel.portraitImage.GetComponent<Animator>();

Re: Get current portrait animator reference?

Posted: Thu Jun 17, 2021 1:57 pm
by VoodooDetective
Oh gosh, i'm being stupid. Thanks very much!

Re: Get current portrait animator reference?

Posted: Thu Jun 17, 2021 1:59 pm
by Tony Li
Glad to help!