I have an agent with a Behavior Tree Owner Component, in which I trigger a Dialogue Tree. The Dialogue Tree is an Asset Graph, but my agent lives in the scene. I’ve added a DialogueActor Component to this agent as well, but when it instigates the Sub Dialogue Tree, there is an error saying there was no DialogueActor component found for the instigator.
What is the correct approach here to make this work? Is there a way to set these DialogueActors dynamically through code?
Just to clarify: are you using the “Start Dialogue Tree” action task and if so, have you assigned a prefab dialogue tree gameobject there and checked the “Is Prefab” option in the action, or are you using a custom action that starts an asset dialogue tree graph?
I was using the SubDialogueTree node (from NestedDT.cs). Creating a prefab with a Dialogue Tree Controller, and linking that in the Start Dialogue Tree Action does indeed use the DialogeActor correctly.
The SubDialogueTree node is to be used when your Dialogue Tree is an asset and you want the agent of the Behaviour Tree to be the instigator of that dialogue and the agent already is a Dialogue Actor (has the component), and you also want to parametrize some of the variables of the Dialogue Tree through the variables of the Behaviour Tree (Variables Mapping in the inspector of the SubDialogueTree node).
The Start Dialogue Action on the other hand is for executing a Dialogue Tree Controller separately (either in the scene, or a prefab) like you did.