Get current portrait animator reference?

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

Get current portrait animator reference?

Post 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.
User avatar
Tony Li
Posts: 22161
Joined: Thu Jul 18, 2013 1:27 pm

Re: Get current portrait animator reference?

Post 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>();
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Re: Get current portrait animator reference?

Post by VoodooDetective »

Oh gosh, i'm being stupid. Thanks very much!
User avatar
Tony Li
Posts: 22161
Joined: Thu Jul 18, 2013 1:27 pm

Re: Get current portrait animator reference?

Post by Tony Li »

Glad to help!
Post Reply