Behaviour Tree Switch Node (Advice Sought)


I’m interested in creating a behaviour tree node that switches based upon enum value, obviously it would be great if you had something similar in the pipeline, but I suspect you don’t. I’ve looked at the SimpleParallel node and there seems to be support for having multiple output pins, and with the extensive support for querying Enums in the engine, it should be relatively easy (???) to create said node.

Any words of advice, suggestions or words of warning would be useful at this point. Finally, if I do manage this feat in a clean manner, is it something that would be of interest to Epic to merge back into source?




Interesting idea. We don’t have any plans for adding new composite nodes due to limited resources - and the same applies to taking code back and supporting it. Sorry :confused:

As the implementation goes, keeping multiple pins looks doable, with each set to accept single node, similar to what UBehaviorTreeGraphNode_SimpleParallel is doing now. Tree building in BTGraphHelpers::CreateChildren should just work too. Enum class can be read directly from blackboard key, as long as tree have associated blackboard (which it needs to have anyway). Remember to add UBTNode::InitializeFromAsset override in your composite for preparing key enum key selector.

In short: BTCompositeNode - easy, BehaviorTreeGraphNode - easy, but annoying to work with.

Thanks for the great reply!