Page 1 of 1

Getting Actor and Conversant Transforms during Conversation

Posted: Mon Dec 06, 2021 6:48 pm
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 :/

Re: Getting Actor and Conversant Transforms during Conversation

Posted: Mon Dec 06, 2021 8:22 pm
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);
}

Re: Getting Actor and Conversant Transforms during Conversation

Posted: Tue Dec 07, 2021 6:40 pm
by jlhacode
Worked like a charm. Thanks Tony!

Re: Getting Actor and Conversant Transforms during Conversation

Posted: Tue Dec 07, 2021 7:32 pm
by Tony Li
Happy to help!