I have a random npc character the is generated through code (at runtime), so I need to add a dialoguesystemtrigger , as a component at runtime.
eg.
Code: Select all
if (addDialogueSystemTriggers)
{
DialogueSystemTrigger dialogueSystemTrigger = BaseCharacterInstance.AddComponent<DialogueSystemTrigger>();
if (Godject.Instance.simplePlayerController != null)
{
dialogueSystemTrigger.conversationActor = Godject.Instance.simplePlayerController.transform;
}
dialogueSystemTrigger.conversationConversant = BaseCharacterInstance.transform;
dialogueSystemTrigger.conversation = conversation;
Usable usable = BaseCharacterInstance.AddComponent<Usable>();
usable.maxUseDistance = 2.0f;
DialogueSystemEvents dialogueSystemEvent = BaseCharacterInstance.AddComponent<DialogueSystemEvents>();
}