Reply To: Serialization not taking place in runtime

NodeCanvas Forums Support Serialization not taking place in runtime Reply To: Serialization not taking place in runtime

#16567
stupidabsurd
Participant

Hey,

I’m using version 3.2.1 with Unity version 2021.3.1f1

Additional information:
My goal is to generate behavior trees programmatically at runtime and assign them to the BehaviourTreeOwner component of an agent prefab as it’s instantiated. The issue is that when I attempt to assign a tree created at runtime to one of my agents, the tree is empty and I receive no warnings/errors. Behaviour trees created in Edit Mode can be assigned with no issue, I only receive issues when creating the tree at runtime.

Since my first post I have setup my scripts to run in Edit Mode. This enables me to programmatically create the trees in Edit Mode and load them into the agents in Play Mode without any issue. However, it is still preferable to handle this at runtime if possible.

The setup:

The agent prefab has Blackboard and BehaviourTreeOwner components attached. I use an AgentProfile class to store the desired behavior tree and assign it to the agent when they spawn.

My logic for creating the trees is nearly identical to the ‘Creating a Behaviour in Code’ guide from the documentation.

Let me know if you need any additional information.

Thanks!