Activate/Deadtivate script with Dialogue

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Markei
Posts: 1
Joined: Thu Nov 09, 2017 11:18 am

Activate/Deadtivate script with Dialogue

Post 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!
User avatar
Tony Li
Posts: 22061
Joined: Thu Jul 18, 2013 1:27 pm

Re: Activate/Deadtivate script with Dialogue

Post 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.
Post Reply