Page 1 of 1

Activate/Deadtivate script with Dialogue

Posted: Thu Nov 09, 2017 11:30 am
by Markei
Hello, I have a script that that I’d like to activate at the start of a dialogue OnUse() interaction and have it deactivate once the dialogue is finished. How would I do this using C# as well as through the Dialogue system if possible. I’m fairly new to this system and I’ve been reading the documentation/following tutorials but haven’t quite gotten the hang of how everything works yet

Thank you in advance!

Re: Activate/Deadtivate script with Dialogue

Posted: Thu Nov 09, 2017 12:42 pm
by Tony Li
Hi,

You can add a Set Component Enabled On Dialogue Event component to the Dialogue Manager GameObject or either of the participants assigned to the Conversation Trigger's Actor or Conversant fields. Set the Trigger to OnConversation. Assign your script to the OnStart and OnEnd sections. In OnStart, set the dropdown to False (i.e., script disabled). In OnEnd, leave the dropdown at True.

If you want to do this in a script, add a script to any of the GameObjects above. Add OnConversationStart(Transform) and OnConversationEnd(Transform) methods to the script. See Script Messages for more info.

Another alternative is to add a Dialogue System Events component to any of the GameObjects above. This component has UnityEvents that you can assign in the inspector.