Reply To: Is there a way to assign the agent at runtime?

NodeCanvas Forums General Discussion Is there a way to assign the agent at runtime? Reply To: Is there a way to assign the agent at runtime?

#9077
Gavalakis
Keymaster

Hello,

I’ve just re-checked the scripts found into that documentation section and seem to work fine.
Can you please clarify what you mean that the agent is becoming null?
When you call StartBehaviour(Graph bt) on BehaviourTreeOwner, the agent for the behaviour tree is assigned once and doesn’t become null later on.
Could it be that you have a task in your behaviour tree that requires a component of which the agent gameobject (BehaviourTreeOwner gameobject) doesn’t have and thus you get the Task Init error stating that it “Failed to change Agent to type x, for Task y or new Agent is NULL. Does the Agent has that Component?”?

Thanks. Please let me know.

Join us on Discord: https://discord.gg/97q2Rjh