Hi,
I have setup some dialogue entries in my template and I set different values of these entries at every node. Is there a way to get a callback containing the event args (using which I can extract my values set at that node) at the start of each node? Currently I could only find OnResponseSelected but that works only for the response nodes.
Thank you
Event containing EventArgs at the start of each node
-
- Posts: 8
- Joined: Thu Apr 29, 2021 1:48 pm
Re: Event containing EventArgs at the start of each node
Hi,
By 'template,' do you mean you've added fields to the Dialogue Entries template in the Dialogue Editor's Templates section?
If so, you can add a script with an OnConversationLine(Subtitle) method to the Dialogue Manager or either of the primary participants. (See Script Messages for details.)
For example, say you've added a Text field named "Mood". You can access it like this:
By 'template,' do you mean you've added fields to the Dialogue Entries template in the Dialogue Editor's Templates section?
If so, you can add a script with an OnConversationLine(Subtitle) method to the Dialogue Manager or either of the primary participants. (See Script Messages for details.)
For example, say you've added a Text field named "Mood". You can access it like this:
Code: Select all
using PixelCrushers.DialogueSystem; // (Add to top of script.)
...
public void OnConversationLine(Subtitle subtitle)
{
string mood = Field.LookupValue(subtitle.dialogueEntry.fields, "Mood");
Debug.Log("Current node's mood is: " + mood);
}
-
- Posts: 8
- Joined: Thu Apr 29, 2021 1:48 pm
Re: Event containing EventArgs at the start of each node
Hi, thank you so much for the reply. Do I need to add this method to a monobehavior and attach that to the dialogue manager?
Is there any other way for example subscribing to an action or getting some sort of a callback on my non-monobehavior classes?
Thank you
Is there any other way for example subscribing to an action or getting some sort of a callback on my non-monobehavior classes?
Thank you
Re: Event containing EventArgs at the start of each node
For non-MonoBehaviours, you can hook into the C# events.