Getting Actor and Conversant Transforms during Conversation

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
jlhacode
Posts: 77
Joined: Fri Jul 03, 2020 6:23 am

Getting Actor and Conversant Transforms during Conversation

Post by jlhacode »

How do we get the GameObject of an Actor and Conversant when a conversation starts?

I created a subclass of DialogueSystemTrigger and made an override method of DoConversationAction(Transform), and tried to access the actorTransform and conversantTransform in the same way as in the base DoConversationAction method, but it didn't work.

I feel like I'm overthinking this problem, but I couldn't find the answer in a search :/
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Getting Actor and Conversant Transforms during Conversation

Post by Tony Li »

Hi,

After a conversation has been started, you can check the C# properties DialogueManager.currentActor and DialogueManager.currentConversant. For example, say you're using the special script method OnConversationStart:

Code: Select all

void OnConversationStart(Transform actor)
{
    Debug.Log("Conversation's actor is: " + DialogueManager.currentActor);
    Debug.Log("Conversation's conversant is: " + DialogueManager.currentConversant);
}
jlhacode
Posts: 77
Joined: Fri Jul 03, 2020 6:23 am

Re: Getting Actor and Conversant Transforms during Conversation

Post by jlhacode »

Worked like a charm. Thanks Tony!
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Getting Actor and Conversant Transforms during Conversation

Post by Tony Li »

Happy to help!
Post Reply