How to Set Property Mappings Via Code

drewv

New member
In some older posts you had mentioned the possibility of posting an example of how to set property mappings via code. I couldn't find anything in the patch notes or documentation.
Earlier posts mention creating an extension method like this:
Code:
public static void SetPropertyMapping(this BehaviorTree tree, string treeVariableName, string mapping, GameObject owner)
{
var sharedVariable = tree.GetVariable(treeVariableName);
sharedVariable.PropertyMapping = mapping;
sharedVariable.PropertyMappingOwner = owner;
sharedVariable.InitializePropertyMapping(tree.GetBehaviorSource());
}

but on the line with "InitializePropertyMapping" I get the following error:
1681070202367.png
 
Can you upload a small repro scene that shows this error so I can take a closer look? There's no need to upload Behavior Designer in that package :)
 
Top