KieranCoppins / Decision-Tree-Package

An open source Unity package for creating Decision Trees with a visual editor. The package comes with some samples to help teach users how to use it and an action manager to handle executing the results of the decision tree.
MIT License
47 stars 2 forks source link
ai decision-tree graph-editor package unity unity-editor unity-package unity-plugin unity3d visual-editor

banner

Decision Trees for Unity

An open source Unity package for creating Decision Trees with a visual editor. The package comes with some samples to help teach users how to use it and an action manager to handle executing the results of the decision tree. Be sure to checkout the video showcase which shows some features of the editor.

Contents

Features

Run-time Visualisation

runtime visualisation

The visual editor supports runtime visualisation where you can monitor individual trees at runtime and see which actions they are currently executing and have executed. This does require a small bit of setup but that is fully covered in the documentation of this package.

Procedural Descriptions & Titles

procedural descriptions

The visual editor will also include any descriptions you may include by overriding the GetDescription and GetSummary functions. This can help you keep track of what your nodes do at a glance without having to view the fields you have set on the node.

Real-time Erroring

realtime erroring

The visual editor also provides errors to you in real time. Since the GetDescription and GetSummary functions are called in editor, you can attach try-catch statements and check for null values in your node. You can then assign error messages to the node view's error property and have them display in the editor!

Full Flexibility

advanced node creation

Sometimes you need a node that can take other nodes as parameters. This visual editor allows you to add as many parameter nodes to your node that you want. How to do this is outlined in the documentation.

Built-in Action Manager

This package also contains a built in action manager. This is a component that you can add to your AI and it will handle executing through the action queue and running it on the AI that it is attached to through coroutines

Sample Assets

The package contains some sample assets to help you understand how to use this package in your project. Be sure to check it out with the unity package manager and read through the heavily commented sample scripts.

How to Install

There are three methods of installing this package: downloading manually, downloading with git url or downloading by name.

Download Manually

To download manually you can:

You should then see this package in your package manager

Download with GitURL

To download with GitURL also requires you to download dependencies locally. Currently Unity doesn't support git dependencies with git packages. This means that you need to make sure you install generic-helpers first.

To install with a GitURL you simply:

Remember: do the same with the generic helpers dependancy.

Download by Name

To download by name requires a bit of setup. Effectively, I am going to be re-iterating is from this forum post from step 4.

The benefit from doing this is that it's very easy to update this package once its setup. Since dependencies will be downloaded automatically, it allows to use the package manager to update this package.