Skip to content

Commit 1fde21d

Browse files
committed
Allow BehaviorTreeBuilder.Splice to receive a null tree, supporting use cases with optional sub-trees
1 parent c10667e commit 1fde21d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Assets/com.fluid.behavior-tree/Runtime/BehaviorTree/Builder/BehaviorTreeBuilder.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using CleverCrow.Fluid.BTs.Decorators;
44
using CleverCrow.Fluid.BTs.TaskParents;
@@ -179,7 +179,9 @@ public BehaviorTreeBuilder AddNode (ITask node) {
179179
}
180180

181181
public BehaviorTreeBuilder Splice (BehaviorTree tree) {
182-
_tree.Splice(PointerCurrent, tree);
182+
if (tree != null && tree.Root != null) {
183+
_tree.Splice(PointerCurrent, tree);
184+
}
183185

184186
return this;
185187
}

0 commit comments

Comments
 (0)