Oh, it is great to hear all of that! IDynamicSubtreeProvider and IDynamicSubtreeVariablesProvider are just interfaces for accessing appropriate subtree asset and variable mapping. Subtree provider returns just BehaviourTree and variable provider a mapping of string to object. It isn’t doing any fancy extraction of variables from the tree and for now is hard-coded. I do agree, that it imposes a risk of messing up when variable name changes, but I guess there is nothing to be done about that, or is there?
My case is a patrol path with various types of point of interest connected to the path node. After arriving at the node, an AI extracts them and saves those objects (SubtreeProvider and VariableProvider, which are the same object in this case) to bb variables and executes subtrees attached to them with provided variables passed down. At the moment there is just looking in some direction with possibility of some other things like interacting with environment. See the code attached.
About inheritance I was thinking about inheriting directly from SubTree and it would just require one new method to pass the variables (example also attached).
Finally the idea of adding dynamic variable mapping sounds also great, it would be possible to just store the variables in immediate parent just before running the subtree and deleting them just after.