{"id":13662707,"url":"https://github.com/ashblue/fluid-behavior-tree","last_synced_at":"2025-05-14T05:10:28.829Z","repository":{"id":34728810,"uuid":"129679493","full_name":"ashblue/fluid-behavior-tree","owner":"ashblue","description":"Behavior trees for Unity3D projects. Written with a code driven approach on the builder pattern.","archived":false,"fork":false,"pushed_at":"2025-02-03T03:07:49.000Z","size":1236,"stargazers_count":1044,"open_issues_count":3,"forks_count":116,"subscribers_count":26,"default_branch":"develop","last_synced_at":"2025-05-12T10:11:58.568Z","etag":null,"topics":["ai","behavior-tree","builder-pattern","unity-package-manager","unity3d","unity3d-plugin"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ashblue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"ashblue","patreon":null,"open_collective":null,"ko_fi":"ashblue","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2018-04-16T03:28:32.000Z","updated_at":"2025-05-09T08:19:27.000Z","dependencies_parsed_at":"2024-05-14T07:53:47.394Z","dependency_job_id":"660308db-66ac-40b1-b14d-be149403985b","html_url":"https://github.com/ashblue/fluid-behavior-tree","commit_stats":{"total_commits":245,"total_committers":8,"mean_commits":30.625,"dds":"0.15102040816326534","last_synced_commit":"7c9b09b9460ce15633a3511c619b0d552027908d"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashblue%2Ffluid-behavior-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashblue%2Ffluid-behavior-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashblue%2Ffluid-behavior-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashblue%2Ffluid-behavior-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashblue","download_url":"https://codeload.github.com/ashblue/fluid-behavior-tree/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076848,"owners_count":22010611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","behavior-tree","builder-pattern","unity-package-manager","unity3d","unity3d-plugin"],"created_at":"2024-08-02T05:02:06.006Z","updated_at":"2025-05-14T05:10:28.796Z","avatar_url":"https://github.com/ashblue.png","language":"C#","readme":"![Fluid Behavior Tree](fluid-behavior-tree.jpg)\n\n[![Build Status](https://travis-ci.org/ashblue/fluid-behavior-tree.svg?branch=master)](https://travis-ci.org/ashblue/fluid-behavior-tree)\n\nBehavior trees for Unity3D projects. Written with a code driven approach to maximize maintainability on large projects with the builder pattern. Inspired by Fluent Behavior Tree.\n\n**Features**\n\n* Extendable, write your own custom re-usable nodes\n* Pre-built library of tasks to kickstart your AI\n* Tree visualizer to debug your trees at runtime\n* Heavily tested with TDD and unit tests\n* Tracks the last position of your behavior tree and restores it the next frame\n* Built for Unity (no integration overhead)\n\n**Support**\n\nJoin the [Discord Community](https://discord.gg/8QHFfzn) if you have questions or need help.\n\nSee upcoming features and development progress on the [Trello Board](https://trello.com/b/BCc33Bcs/fluid-behavior-tree).\n\n## Getting Started\n\nWhen creating trees you'll need to store them in a variable to properly cache all the necessary data.\n\n```C#\nusing UnityEngine;\nusing CleverCrow.Fluid.BTs.Tasks;\nusing CleverCrow.Fluid.BTs.Trees;\n\npublic class MyCustomAi : MonoBehaviour {\n    [SerializeField]\n    private BehaviorTree _tree;\n    \n    private void Awake () {\n        _tree = new BehaviorTreeBuilder(gameObject)\n            .Sequence()\n                .Condition(\"Custom Condition\", () =\u003e {\n                    return true;\n                })\n                .Do(\"Custom Action\", () =\u003e {\n                    return TaskStatus.Success;\n                })\n            .End()\n            .Build();\n    }\n\n    private void Update () {\n        // Update our tree every frame\n        _tree.Tick();\n    }\n}\n```\n\n### What a Returned TaskStatus Does\n\nDepending on what you return for a task status different things will happen.\n\n* Success: Node has finished, next `tree.Tick()` will restart the tree if no other nodes to run\n* Failure: Same as success, except informs that the node failed\n* Continue: Rerun this node the next time `tree.Tick()` is called. A pointer reference is tracked by the tree and can only be cleared if `tree.Reset()` is called.\n\n### Tree Visualizer\n\nAs long as your tree storage variable is set to `public` or has a `SerializeField` attribute. You'll be able to print a visualization of your tree while the game is running in the editor. Note that you cannot view trees while the game is not running. As the tree has to be built in order to be visualized.\n\n![Visualizer](tree-visualizer.png)\n\n### Extending Trees\n\nYou can safely add new code to your behavior trees with several lines. Allowing you to customize BTs while supporting future version upgrades. \n\n```c#\nusing UnityEngine;\nusing CleverCrow.Fluid.BTs.Tasks;\nusing CleverCrow.Fluid.BTs.Tasks.Actions;\nusing CleverCrow.Fluid.BTs.Trees;\n\npublic class CustomAction : ActionBase {\n    protected override TaskStatus OnUpdate () {\n        Debug.Log(Owner.name);\n        return TaskStatus.Success;\n    }\n}\n\npublic static class BehaviorTreeBuilderExtensions {\n    public static BehaviorTreeBuilder CustomAction (this BehaviorTreeBuilder builder, string name = \"My Action\") {\n        return builder.AddNode(new CustomAction { Name = name });\n    }\n}\n\npublic class ExampleUsage : MonoBehaviour {\n    public void Awake () {\n        var bt = new BehaviorTreeBuilder(gameObject)\n            .Sequence()\n                .CustomAction()\n            .End();\n    }\n}\n```\n\n### Installing\n\nFluid Behavior Tree is used through [Unity's Package Manager](https://docs.unity3d.com/Manual/CustomPackages.html). In order to use it you'll need to add the following lines to your `Packages/manifest.json` file. After that you'll be able to visually control what specific version of Fluid Behavior Tree you're using from the package manager window in Unity. This has to be done so your Unity editor can connect to NPM's package registry.\n\n```json\n{\n  \"scopedRegistries\": [\n    {\n      \"name\": \"NPM\",\n      \"url\": \"https://registry.npmjs.org\",\n      \"scopes\": [\n        \"com.fluid\"\n      ]\n    }\n  ],\n  \"dependencies\": {\n    \"com.fluid.behavior-tree\": \"2.2.0\"\n  }\n}\n```\n\nArchives of specific versions and release notes are available on the [releases page](https://github.com/ashblue/fluid-behavior-tree/releases).\n\n### Example Scene\n\nYou might want to look at the [capture the flag](https://github.com/ashblue/fluid-behavior-tree-ctf-example) example project \nfor a working example of how Fluid Behavior Tree can be used in your project. It demonstrates real time usage\nwith units who attempt to capture the flag while grabbing power ups to try and gain the upper hand.\n\n## Table of Contents\n\n  * [Library](#library)\n    + [Actions](#actions)\n      - [Generic](#action-generic)\n      - [Wait](#wait)\n      - [Wait Time](#wait-time)\n    + [Conditions](#conditions)\n      - [Generic](#condition-generic)\n      - [RandomChance](#randomchance)\n    + [Composites](#composites)\n      - [Sequence](#sequence)\n      - [Selector](#selector)\n      - [SelectorRandom](#selectorrandom)\n      - [Parallel](#parallel)\n    + [Decorators](#decorators)\n      - [Generic](#decorator-generic)\n      - [Inverter](#inverter)\n      - [ReturnSuccess](#returnsuccess)\n      - [ReturnFailure](#returnfailure)\n      - [RepeatForever](#repeatforever)\n      - [RepeatUntilFailure](#repeatuntilfailure)\n      - [RepeatUntilSuccess](#repeatuntilsuccess)\n  * [Creating Reusable Behavior Trees](#creating-reusable-behavior-trees)\n  * [Creating Custom Reusable Nodes](#creating-custom-reusable-nodes)\n    + [Your First Custom Node and Tree](#your-first-custom-node-and-extension)\n    + [Custom Actions](#custom-actions)\n    + [Custom Conditions](#custom-conditions)\n    + [Custom Composites](#custom-composites)\n    + [Custom Decorators](#custom-decorators)\n  * [Formatting Issues](#formatting-issues)\n  * [Nightly Builds](#nightly-builds)\n  * [Development Environment](#development-environment)\n    + [Submitting your own actions, conditions, ect](#making-commits)\n    + [Pull Requests / Contributing](#pull-requests--contributing)\n  * [Contributor Credits](#contributor-credits)\n\n## Example Scene\n\nYou might want to look at the [capture the flag](https://github.com/ashblue/fluid-behavior-tree-ctf-example) example project \nfor a working example of how Fluid Behavior Tree can be used in your project. It demonstrates real time usage\nwith units who attempt to capture the flag while grabbing power ups to try and gain the upper hand.\n\n## Library\n\nFluid Behavior Tree comes with a robust library of pre-made actions, conditions, composites, and other nodes\nto help speed up your development process.\n\n### Actions\n\n#### Action Generic\n\nYou can create a generic action on the fly. If you find yourself re-using the same actions you might want to\nlook into the section on writing your own custom actions.\n\n```C#\n.Sequence()\n    .Do(\"Custom Action\", () =\u003e {\n        return TaskStatus.Success;\n    })\n.End()\n```\n\n#### Wait\n\nSkip a number of ticks on the behavior tree.\n\n```C#\n.Sequence()\n    // Wait for 1 tick on the tree before continuing\n    .Wait(1)\n    .Do(MyAction)\n.End()\n```\n\n#### Wait Time\n\nWaits until the passed number of seconds have expired in `deltaTime`.\n\n```C#\n.Sequence()\n    .WaitTime(2.5f)\n    .Do(MyAction)\n.End()\n```\n\n### Conditions\n\n#### Condition Generic\n\nYou can create a generic condition on the fly. If you find yourself re-using the same actions you might want to\nlook into the section on writing your own custom conditions.\n\n```C#\n.Sequence()\n    .Condition(\"Custom Condtion\", () =\u003e {\n        return true;\n    })\n    .Do(MyAction)\n.End()\n```\n\n#### RandomChance\n\nRandomly evaluate a node as true or false based upon the passed chance.\n\n```C#\n.Sequence()\n    // 50% chance this will return success\n    .RandomChance(1, 2)\n    .Do(MyAction)\n.End()\n```\n\n### Composites\n\n#### Sequence\n\nRuns each child node in order and expects a *Success* status to tick the next node. If *Failure* is returned, the sequence will stop executing child nodes and return *Failure* to the parent.\n\n**NOTE** It's important that every composite is followed by a `.End()` statement. This makes sure that your nodes\nare properly nested when the tree is built.\n\n```C#\n.Sequence()\n    .Do(() =\u003e { return TaskStatus.Success; })\n    .Do(() =\u003e { return TaskStatus.Success; })\n    \n    // All tasks after this will not run and the sequence will exit\n    .Do(() =\u003e { return TaskStatus.Failure; })\n\n    .Do(() =\u003e { return TaskStatus.Success; })\n.End()\n```\n\n#### Selector\n\nRuns each child node until *Success* is returned.\n\n```C#\n.Selector()\n    // Runs but fails\n    .Do(() =\u003e { return TaskStatus.Failure; })\n\n    // Will stop here since the node returns success\n    .Do(() =\u003e { return TaskStatus.Success; })\n    \n    // Does not run\n    .Do(() =\u003e { return TaskStatus.Success; })\n.End()\n```\n\n#### SelectorRandom\n\nRandomly selects a child node with a shuffle algorithm. Looks until `Success` is returned or every node fails. Shuffles every time the tree initially start running it.\n\n```C#\n.SelectorRandom()\n    .Do(() =\u003e { return TaskStatus.Failure; })\n    .Do(() =\u003e { return TaskStatus.Success; })\n    .Do(() =\u003e { return TaskStatus.Failure; })\n.End()\n```\n\n#### Parallel\n\nRuns all child nodes at the same time until they all return *Success*. Exits and stops all running nodes if ANY of them return *Failure*.\n\n```C#\n.Parallel()\n    // Both of these tasks will run every frame\n    .Do(() =\u003e { return TaskStatus.Continue; })\n    .Do(() =\u003e { return TaskStatus.Continue; })\n.End()\n```\n\n### Decorators\n\nDecorators are parent elements that wrap any node to change the return value (or execute special logic). They are\nextremely powerful and a great compliment to actions, conditions, and composites.\n\n#### Decorator Generic\n\nYou can wrap any node with your own custom decorator code. This allows you to customize re-usable functionality.\n\n**NOTE**: You must manually call `Update()` on the child node or it will not fire. Also every decorator must be followed\nby a `.End()` statement. Otherwise the tree will not build correctly.\n\n```C#\n.Sequence()\n    .Decorator(\"Return Success\", child =\u003e {\n        child.Update();\n        return TaskStatus.Success;\n    })\n        .Do(() =\u003e { return TaskStatus.Failure; })\n    .End()\n    .Do(() =\u003e { return TaskStatus.Success; })\n.End()\n```\n\n#### Inverter\n\nReverse the returned status of the child node if it's `TaskStatus.Success` or `TaskStatus.Failure`. \nDoes not change `TaskStatus.Continue`.\n\n```C#\n.Sequence()\n    .Inverter()\n        .Do(() =\u003e { return TaskStatus.Success; })\n    .End()\n.End()\n```\n\n#### ReturnSuccess\n\nReturn `TaskStatus.Success` if the child returns `TaskStatus.Failure`.\nDoes not change `TaskStatus.Continue`.\n\n```C#\n.Sequence()\n    .ReturnSuccess()\n        .Do(() =\u003e { return TaskStatus.Failure; })\n    .End()\n.End()\n```\n\n#### ReturnFailure\n\nReturn `TaskStatus.Failure` if the child returns `TaskStatus.Success`.\nDoes not change `TaskStatus.Continue`.\n\n```C#\n.Sequence()\n    .ReturnFailure()\n        .Do(() =\u003e { return TaskStatus.Success; })\n    .End()\n.End()\n```\n\n#### RepeatForever\n\nReturn `TaskStatus.Continue` regardless of what status the child returns. This decorator (and all descendent\ntasks) can be interrupted by calling `BehaviorTree.Reset()`.\n\n```C#\n.Sequence()\n    .RepeatForever()\n        .Do(() =\u003e { return TaskStatus.Success; })\n    .End()\n.End()\n```\n\n#### RepeatUntilFailure\n\nReturn `TaskStatus.Failure` if the child returns `TaskStatus.Failure`, otherwise it returns `TaskStatus.Continue`.\n\n```C#\n.Sequence()\n    .RepeatUntilFailure()\n        .Do(() =\u003e { return TaskStatus.Success; })\n    .End()\n.End()\n```\n\n#### RepeatUntilSuccess\n\nReturn `TaskStatus.Success` if the child returns `TaskStatus.Success`, otherwise it returns `TaskStatus.Continue`.\n\n```C#\n.Sequence()\n    .RepeatUntilSuccess()\n        .Do(() =\u003e { return TaskStatus.Success; })\n    .End()\n.End()\n```\n\n## Creating Reusable Behavior Trees\n\nTrees can be combined with just a few line of code. This allows you to create injectable behavior trees that bundles different\nnodes for complex functionality such as searching or attacking.\n\nBe warned that spliced trees require a newly built tree for injection, as nodes are only deep copied on `.Build()`.\n\n```C#\nusing CleverCrow.Fluid.BTs.Trees;\nusing CleverCrow.Fluid.BTs.Tasks;\nusing UnityEngine;\n\npublic class MyCustomAi : MonoBehaviour {\n    private BehaviorTree _tree;\n    \n    private void Awake () {\n        var injectTree = new BehaviorTreeBuilder(gameObject)\n            .Sequence()\n                .Do(\"Custom Action\", () =\u003e {\n                    return TaskStatus.Success;\n                })\n            .End();\n\n        _tree = new BehaviorTreeBuilder(gameObject)\n            .Sequence()\n                .Splice(injectTree.Build())\n                .Do(\"Custom Action\", () =\u003e {\n                    return TaskStatus.Success;\n                })\n            .End()\n            .Build();\n    }\n\n    private void Update () {\n        // Update our tree every frame\n        _tree.Tick();\n    }\n}\n```\n\n## Creating Custom Reusable Nodes\n\nWhat makes Fluid Behavior Tree so powerful is the ability to write your own nodes and add them to the builder without editing any source. You can even create Unity packages that add new builder functionality. For example we can write a new tree builder method like this that sets the target of your AI system with just a few lines of code.\n\n```C#\nvar tree = new BehaviorTreeBuilder(gameObject)\n    .Sequence()\n        .AgentDestination(\"Find Enemy\", target)\n        .Do(() =\u003e {\n            // Activate chase enemy code\n            return TaskStatus.Success; \n        })\n    .End()\n    .Build();\n```\n\n### Your First Custom Node and Extension\n\nIt should take about 3 minutes to create your first custom action and implement it. First create a new action.\n\n```C#\nusing CleverCrow.Fluid.BTs.Tasks;\nusing CleverCrow.Fluid.BTs.Tasks.Actions;\nusing UnityEngine;\nusing UnityEngine.AI;\n\npublic class AgentDestination : ActionBase {\n    private NavMeshAgent _agent;\n    public Transform target;\n\n    protected override void OnInit () {\n        _agent = Owner.GetComponent\u003cNavMeshAgent\u003e();\n    }\n\n    protected override TaskStatus OnUpdate () {\n        _agent.SetDestination(target.position);\n        return TaskStatus.Success;\n    }\n}\n```\n\nNext we need to extend the `BehaviorTreeBuilder` script with our new AgentDestination action. For more information on C# class extensions see the [official docs](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/extension-methods).\n\n```C#\nusing CleverCrow.Fluid.BTs.Trees;\n\npublic static class BehaviorTreeBuilderExtensions {\n    public static BehaviorTreeBuilder AgentDestination (this BehaviorTreeBuilder builder, string name, Transform target) {\n        return builder.AddNode(new AgentDestination {\n            Name = name,\n            target = target,\n        });\n    }\n}\n```\n\nAnd you're done! You've now created a custom action and extendable behavior tree builder that's future proofed for new versions. The following examples will be more of the same. But each covers a different node type.\n\n### Custom Actions\n\nYou can create your own custom actions with the following template. This is useful for bundling up code\nthat you're using constantly.\n\n```C#\nusing UnityEngine;\nusing CleverCrow.Fluid.BTs.Tasks;\nusing CleverCrow.Fluid.BTs.Tasks.Actions;\n\npublic class CustomAction : ActionBase {\n    // Triggers only the first time this node is run (great for caching data)\n    protected override void OnInit () {\n    }\n\n    // Triggers every time this node starts running. Does not trigger if TaskStatus.Continue was last returned by this node\n    protected override void OnStart () {\n    }\n\n    // Triggers every time `Tick()` is called on the tree and this node is run\n    protected override TaskStatus OnUpdate () {\n        // Points to the GameObject of whoever owns the behavior tree\n        Debug.Log(Owner.name);\n        return TaskStatus.Success;\n    }\n\n    // Triggers whenever this node exits after running\n    protected override void OnExit () {\n    }\n}\n```\n\nAdd your new node to an extension.\n\n```c#\nusing CleverCrow.Fluid.BTs.Trees;\n\npublic static class BehaviorTreeBuilderExtensions {\n    public static BehaviorTreeBuilder CustomAction (this BehaviorTreeBuilder builder, string name = \"My Action\") {\n        return builder.AddNode(new CustomAction {\n            Name = name,\n        });\n    }\n}\n```\n\n### Custom Conditions\n\nCustom conditions can be added with the following example template. You'll want to use these for checks such as sight,\nif the AI can move to a location, and other tasks that require a complex check.\n\n```C#\nusing UnityEngine;\nusing CleverCrow.Fluid.BTs.Tasks;\n\npublic class CustomCondition : ConditionBase {\n    // Triggers only the first time this node is run (great for caching data)\n    protected override void OnInit () {\n    }\n\n    // Triggers every time this node starts running. Does not trigger if TaskStatus.Continue was last returned by this node\n    protected override void OnStart () {\n    }\n\n    // Triggers every time `Tick()` is called on the tree and this node is run\n    protected override bool OnUpdate () {\n        // Points to the GameObject of whoever owns the behavior tree\n        Debug.Log(Owner.name);\n        return true;\n    }\n\n    // Triggers whenever this node exits after running\n    protected override void OnExit () {\n    }\n}\n```\n\nAdd the new condition to your behavior tree builder with the following snippet.\n\n```c#\nusing CleverCrow.Fluid.BTs.Trees;\n\npublic static class BehaviorTreeBuilderExtensions {\n    public static BehaviorTreeBuilder CustomCondition (this BehaviorTreeBuilder builder, string name = \"My Condition\") {\n        return builder.AddNode(new CustomCondition {\n            Name = name,\n        });\n    }\n}\n```\n\n### Custom Composites\n\nFluid Behavior Tree isn't limited to just custom actions and conditions. You can create new composite types with a fairly\nsimple API. Here is an example of a basic sequence.\n\n```C#\nusing CleverCrow.Fluid.BTs.TaskParents.Composites;\nusing CleverCrow.Fluid.BTs.Tasks;\n\npublic class CustomSequence : CompositeBase {\n    protected override TaskStatus OnUpdate () {            \n        for (var i = ChildIndex; i \u003c Children.Count; i++) {\n            var child = Children[ChildIndex];\n\n            var status = child.Update();\n            if (status != TaskStatus.Success) {\n                return status;\n            }\n\n            ChildIndex++;\n        }\n\n        return TaskStatus.Success;\n    }\n}\n```\n\nAdding custom composites to your behavior tree is just as simple as adding actions. Just takes one line of code.\n\n```c#\nusing CleverCrow.Fluid.BTs.Trees;\n\npublic static class BehaviorTreeBuilderExtensions {\n    public static BehaviorTreeBuilder CustomSequence (this BehaviorTreeBuilder builder, string name = \"My Sequence\") {\n        return builder.ParentTask\u003cCustomSequence\u003e(name);\n    }\n}\n```\n\n### Custom Decorators\n\nDecorators can also be custom written to cut down on repetitive code.\n\n```C#\nusing CleverCrow.Fluid.BTs.Decorators;\nusing CleverCrow.Fluid.BTs.Tasks;\n\npublic class CustomInverter : DecoratorBase {\n    protected override TaskStatus OnUpdate () {\n        if (Child == null) {\n            return TaskStatus.Success;\n        }\n\n        var childStatus = Child.Update();\n        var status = childStatus;\n\n        switch (childStatus) {\n            case TaskStatus.Success:\n                status = TaskStatus.Failure;\n                break;\n            case TaskStatus.Failure:\n                status = TaskStatus.Success;\n                break;\n        }\n\n        return status;\n    }\n}\n```\n\nImplementing decorators is similar to composites. If you need to set arguments on the composite you'll want to take a loot at the method `BehaviorTreeBuilder.AddNodeWithPointer()`.\n\n```c#\nusing CleverCrow.Fluid.BTs.Trees;\n\npublic static class BehaviorTreeBuilderExtensions {\n    public static BehaviorTreeBuilder CustomInverter (this BehaviorTreeBuilder builder, string name = \"My Inverter\") {\n        // See BehaviorTreeBuilder.AddNodeWithPointer() if you need to set custom composite data from arguments\n        return builder.ParentTask\u003cCustomInverter\u003e(name);\n    }\n}\n```\n\n## Formatting Issues\n\nIf you are using an auto formatter it will probably mangle your code formatting with the builder syntax. To avoid this you can turn off formatting like so in JetBrains Rider. If you need a specific IDE, it shouldn't be too hard to google the specific formatting disable comment you need.\n\n```c#\n// @formatter:off\n_tree = new BehaviorTreeBuilder(gameObject)\n    .Sequence()\n        .Condition(\"Custom Condition\", () =\u003e {\n            return true;\n        })\n        .Do(\"Custom Action\", () =\u003e {\n            return TaskStatus.Success;\n        })\n    .End()\n    .Build();\n// @formatter:on\n```\n\n## Nightly Builds\n\nTo access nightly builds of `develop` that are package manager friendly you'll need to manually edit your `Packages/manifest.json` as so. \n\n```json\n{\n    \"dependencies\": {\n      \"com.fluid.behavior-tree\": \"https://github.com/ashblue/fluid-behavior-tree.git#nightly\"\n    }\n}\n```\n\nNote that to get a newer nightly build you must delete this line and any related lock data in the manifest, let Unity rebuild, then add it back. As Unity locks the commit hash for Git urls as packages.\n\n\n## Development Environment\n\nIf you wish to run to run the development environment you'll need to install [node.js](https://nodejs.org/en/). Then run the following from the root once.\n\n`npm install`\n\nIf you wish to create a build run `npm run build` from the root and it will populate the `dist` folder.\n\n### Making Commits\n\nAll commits should be made using [Commitizen](https://github.com/commitizen/cz-cli) (which is automatically installed when running `npm install`). Commits are automatically compiled to version numbers on release so this is very important. PRs that don't have Commitizen based commits will be rejected.\n\nTo make a commit type the following into a terminal from the root\n\n```bash\nnpm run commit\n```\n\n### Pull Requests / Contributing\n\nPlease see the [Contributing Guidelines](CONTRIBUTING.md) document for more info.\n\n## Contributor Credits\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://blueashes.com\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/643307?v=4?s=100\" width=\"100px;\" alt=\"Ash Blue\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAsh Blue\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ashblue/fluid-behavior-tree/commits?author=ashblue\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://jesse.tg\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/1175189?v=4?s=100\" width=\"100px;\" alt=\"Jesse Talavera-Greenberg\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJesse Talavera-Greenberg\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ashblue/fluid-behavior-tree/commits?author=JesseTG\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/PureSaltProductions\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/52610924?v=4?s=100\" width=\"100px;\" alt=\"PureSaltProductions\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePureSaltProductions\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#userTesting-PureSaltProductions\" title=\"User Testing\"\u003e📓\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/mduvergey\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/18513379?v=4?s=100\" width=\"100px;\" alt=\"Martin Duvergey\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMartin Duvergey\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ashblue/fluid-behavior-tree/issues?q=author%3Amduvergey\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/call-stack\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/38575304?v=4?s=100\" width=\"100px;\" alt=\"call-stack\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ecall-stack\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ashblue/fluid-behavior-tree/issues?q=author%3Acall-stack\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/piotr-j\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/2499728?v=4?s=100\" width=\"100px;\" alt=\"Piotr Jastrzebski\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePiotr Jastrzebski\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ashblue/fluid-behavior-tree/commits?author=piotr-j\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/hookSSi\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/12372136?v=4?s=100\" width=\"100px;\" alt=\"Sounghoo\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eSounghoo\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ashblue/fluid-behavior-tree/commits?author=hookSSi\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/TNThomas\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/9881915?v=4?s=100\" width=\"100px;\" alt=\"TNThomas\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eTNThomas\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ashblue/fluid-behavior-tree/issues?q=author%3ATNThomas\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e \u003ca href=\"https://github.com/ashblue/fluid-behavior-tree/commits?author=TNThomas\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/Ownez\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/10993641?v=4?s=100\" width=\"100px;\" alt=\"Ownez\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eOwnez\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ashblue/fluid-behavior-tree/commits?author=Ownez\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/angstr0m\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/733176?v=4?s=100\" width=\"100px;\" alt=\"angstr0m\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eangstr0m\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ashblue/fluid-behavior-tree/issues?q=author%3Aangstr0m\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/darkgnostic\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/4980221?v=4?s=100\" width=\"100px;\" alt=\"Izzy\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eIzzy\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ashblue/fluid-behavior-tree/issues?q=author%3Adarkgnostic\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/JeremyVansnick\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/23563794?v=4?s=100\" width=\"100px;\" alt=\"JeremyVansnick\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJeremyVansnick\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ashblue/fluid-behavior-tree/commits?author=JeremyVansnick\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","funding_links":["https://github.com/sponsors/ashblue","https://ko-fi.com/ashblue"],"categories":["C\\#","Open Source Repositories","C#","Open Source Packages"],"sub_categories":["AI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashblue%2Ffluid-behavior-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashblue%2Ffluid-behavior-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashblue%2Ffluid-behavior-tree/lists"}