Splatter.AI is a code based behaviour tree for Unity projects. Current version v0.0.6 can be found in the releases, note there may be breaking changes while in early preview.
To add to your Unity project go to the Package Manager, click the plus in the top left of the window. Select git URL and enter: https://github.com/ormesam/splatter.ai.git?path=/src/Assets/Splatter.AI
Quick Start More Docs...
- Create new class deriving from BehaviourTree
- Override
Awake
method (optional) and initiate blackboard values, make sure to callbase.Awake();
at the start of the method - Override
CreateRoot
method, here you can build up your behaviour tree using theBehaviourTreeBuilder
class as shown below - Attach the script to the GameObject
- The tree will be executed every frame
View the wiki for more documentation.
using Splatter.AI;
public class ZombieBehaviourTree : BehaviourTree {
public override void Awake() {
base.Awake();
Blackboard[ZombieKey] = GetComponent<Zombie>();
}
protected override Node CreateRoot() {
return new BehaviourTreeBuilder(this)
.Sequence()
.Name("root")
.Do("custom action", () => {
return NodeResult.Success;
})
.End()
.Build();
}
}
Found under Samples