[Solved] Attach actor via script

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Japtor
Posts: 120
Joined: Thu Jun 28, 2018 1:41 pm

[Solved] Attach actor via script

Post by Japtor »

Hi

Is it possible to attach the actor to the Dialogue System Trigger -> Actions -> Start Conversation -> Conversation Actor via script?

Thanks!
Last edited by Japtor on Sun Nov 04, 2018 3:46 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Attach actor via script

Post by Tony Li »

Hi,

Yes, you can set DialogueSystemTrigger.conversationActor. For example:

Code: Select all

GetComponent<DialogueSystemTrigger>().conversationActor = someTransform;
This assumes that you will set it before triggering the Dialogue System Trigger.

If you need to set it after triggering the Dialogue System Trigger, I can make two suggestions:

1. Leave the Conversation Actor field blank. If it's triggered by OnUse or OnTriggerEnter (or OnTriggerExit, OnCollisionEnter, or OnCollisionExit), it will automatically assign the GameObject that caused the trigger to fire.

2. Or manually change the values assigned to DialogueManager.conversationModel.actorInfo.
Japtor
Posts: 120
Joined: Thu Jun 28, 2018 1:41 pm

Re: Attach actor via script

Post by Japtor »

Hi,

Thanks! It worked! :)
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: [Solved] Attach actor via script

Post by Tony Li »

Awesome! Happy to help.
Post Reply