Setting behaviour tree from script

I have a swordman that can be either an ally or an enemy. Since I dont want to create seperate prefabs for the enemy and the ally Ive been setting the values that differ at runtime. However I am not sure hot to do this with behaviour tree. Can I somehow change the behaviour tree that loads depending on if X is true or false?

ie:

Code:
if(ally) LoadAllyBt();
else LoadEnemyBt();
EnableBt();
 
Sure, you can use external behavior trees for this purpose and set the ExternalBehavior property to the tree that you want to load.

 
Top