GraphViewBehaviorTree
Behavior Tree using UI Builder, GraphView, and Scriptable Objects in Unity 2021.3
Install / Use
/learn @JamesLaFritz/GraphViewBehaviorTreeREADME
About The Project

I had code on sitting around on my hard drive for a Behavior Tree Editor That inspired me to create a bBehavior Tree Editor and write Articles about Behavior Tree and Using the Unity Editor UI Builder. It has been Pointed Out to me very polite and professional that this code is actually from the KIWI Coder.
Behavior Tree using UI Builder, GraphView, and Scriptable Objects in Unity 2021.3
This can be used as a template to build any type on Node Based Editor in Unity. i.e Dialog System or an AI Behavior Tree. If using for AI Behavior tree I would probably use Single Input Ports not Multiple. Even though the Nodes themselves are Scriptable Objects this can be changed and there is nothing that states that you have to use Scriptable Objects as the type for the nodes, this was just a decision that I made as it is easier to Bing the properties off the Node. Also there is nothing sating that the Nodes have to be stored in the Asset itself as I have done.
Behavior Tree is an execution tree (uses the Strategy pattern) and always starts with a Root Node. This will be so that the behavior tree knows where to start. Root Node has only one child. Now there are 3 basic main type of nodes Decorator, Composite Node and Action Node. Each Node can return one of three states Running, Success, or Failure. All nodes will be saved in Unity as Scriptable Objects. A Behavior tree will be a Scriptable Object containing all the Nodes in it.
Decorator Node
- Has one child and is capable of augmenting the return state of it's child. This uses the Decorator pattern.
Composite Node
- Has a list of children and is the control flow of the behavior tree like switch statements and for loops. There are 2 types Composite Nodes the Selector and Sequence. This uses the Composite pattern.
Action Node
- The Leaf of the tree, has no children, and is where all of the logic gets implemented.
Built With
- <a href="https://www.linkedin.com/in/james-lafritz/"><img src="https://img.shields.io/badge/Unity-100000?style=for-the-badge&logo=unity&logoColor=white"/></a>
Installation
To install this into your project for modifications Clone or Download the code from Git Hub into the Asset Folder of your project. Change the Folder From GraphView Behavior Tree to mach what you wold like. Edit all Files and change the NameSpace to match your new Folder Name. Do Not forget to change this in the UXML Documents as well. i.e "GraphViewBehaviorTree.Editor.SplitView" Delete the Runtime/james.lafritz.GraphViewBehaviorTree and Editor/james.lafritz.GraphViewBehaviorTree.Editor Assembly Definition Files, Or Edit/Replace them with your own.
To use Template as is Use the Package manager to Install package from Git Hub. see Creating custom packages for use in Unity
- In Unity open the package manager
- Go to Window->PackageManager

- Install this Package from git url
- Click the Plus Drop down
- Select "add package from git URL"
- https://github.com/JamesLaFritz/GraphViewBehaviorTree.git
- Select add

Articles
Using Unity’s UI Builder: Basic Set Up
Using Unity’s UI Builder: Serialized Object data binding
Using Unity’s UI Builder: Adding Custom Controls
Using Unity’s Graph View: Adding and Deleting Nodes
Using Unity’s Graph View: Node Position, Code/Editor Window Reload
Using Unity’s Graph View: Connecting Nodes in The Editor
Inspector View in an Editor Window
<!-- ROADMAP -->Roadmap
See the open issues for a list of proposed features (and known issues).
<!-- LICENSE -->License
Distributed under the MIT License. See LICENSE for more information.
Acknowledgements
<!-- Repo Card Exclusive Options: show_owner - Show the repo's owner name (boolean) Common Options: title_color - Card's title color (hex color) text_color - Body text color (hex color) icon_color - Icons color if available (hex color) border_color - Card's border color (hex color). (Does not apply when hide_border is enabled) bg_color - Card's background color (hex color) or a gradient in the form of angle,start,end hide_border - Hides the card's border (boolean) theme - name of the theme, choose from all available themes cache_seconds - set the cache header manually (min: 1800, max: 86400) locale - set the language in the card (e.g. cn, de, es, etc.) border_radius - Corner rounding on the card_ GradiRelated Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。


