How to get currently speaking actor through code?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
EntertainmentForge
Posts: 23
Joined: Sun Nov 29, 2020 8:50 pm

How to get currently speaking actor through code?

Post by EntertainmentForge »

I stumbled trying to get info about the current actor who is talking. I tried several things but I always get the actor that started the conversation. Never the currently speaking actor.

I tried few things but it always get's me Player or Actor who started conversation. Not the currently speaking one.

Code: Select all

dialogueSystemController.conversationController.actorInfo.Name
dialogueSystemController.CurrentActor.name
DialogueManager.conversationModel.actorInfo.Name
Pretty much all I need is the name of the actor. I am guessing these is some function that serves this purpose but I'm missing it.

P.S. Great asset!
User avatar
Tony Li
Posts: 22050
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to get currently speaking actor through code?

Post by Tony Li »

Hi,

DialogueManager.currentConversationState contains all the info about the current state of the conversation.

Code: Select all

string currentActorName = DialogueManager.currentConversationState.subtitle.speakerInfo.Name;
EntertainmentForge
Posts: 23
Joined: Sun Nov 29, 2020 8:50 pm

Re: How to get currently speaking actor through code?

Post by EntertainmentForge »

That's exactly what I needed. Thanks!
User avatar
Tony Li
Posts: 22050
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to get currently speaking actor through code?

Post by Tony Li »

Glad to help!
Post Reply