How do I create the dialogue system events component in code?
I have NPCs that have dialogue system events for when a convo starts and ends but the problem is - they all have the same events so I want to hard code that instead of having to put a dialogue system component in and putting in several function calls for each NPC. How do I do this?
Dialogue System Events in Code
Re: Dialogue System Events in Code
Hi,
You can add a DialogueSystemEvents component:
but it's probably better to just add the script methods directly:
You can add a DialogueSystemEvents component:
Spoiler
Code: Select all
var dialogueSystemEvents = gameObject.AddComponent<DialogueSystemEvents>();
dialogueSystemEvents.conversationEvents.onConversationStart(SomeMethod);
Code: Select all
void OnConversationStart(Transform actor)
{
// Do something when conversation starts.
}
void OnConversationEnd(Transform actor)
{
// Do something when conversation ends.
}
//etc.