Hi,
The tables on
this page explain which GameObjects receive events such as OnConversationStart and OnConversationEnd.
OnConversationEnd is sent to the Dialogue Manager GameObject and the conversation participants' GameObjects. You can specify the participant GameObjects in DialogueManager.StartConversation. For example:
Code: Select all
DialogueManager.StartConversation ("New Conversation 2", GameObject.FindWithTag("Player").transform, this.transform);
The OnConversationEnd event will be sent to the Dialogue Manager, the GameObject tagged "Player", and the GameObject running this script (i.e., your NPC).
If you don't specify participants, the Dialogue System will attempt to find a GameObject whose name matches the actor's name in the dialogue database. If you've added an
Override Actor Name component to a GameObject, the Dialogue System will match the GameObject to the actor name.
If you temporarily set the Dialogue Manager's Debug Level to Info, it will log a lot of information to the Console window. You should be able to find a line like:
Code: Select all
Dialogue System: Starting conversation 'New Conversation 2' with actor=XXX and conversant=YYY.
where XXX and YYY are GameObjects in the scene.
Since you're already writing a script, I'd recommend using the OnConversationEnd(Transform) method so it's all in the script instead of also using a Dialogue System Events component. For example:
Code: Select all
public class YourNPCScript : MonoBehaviour {
IEnumerator YourCoroutine() {
DialogueManager.StartConversation ("New Conversation 2", GameObject.FindWithTag("Player").transform, this.transform);
}
void OnConversationEnd(Transform actor) {
Debug.Log("THE CONVERSATION ENDED!!!");
}
}