Skip to content

Zombie1111/UnityBehaviourList

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unity Behaviour List

Table of Contents

Overview

A Behaviour List is a list of states and conditions to change the state. Each state can be assigned a script (The behaviour of the state) and the conditions are a list of scripts. Like a semi-visual state machine.

Image of Behaviour List

Key Features

  • Create your own states and conditions by simply inherit a abstract class
  • Share data between states and conditions through the Behaviour List ListData object
  • States can be updated from any thread (Although not at the same time)
  • Custom Behaviour List inspector

Instructions

Requirements (Should work in other versions and render pipelines)

  • Unity 2023.2.20f1 (Built-in)

General Setup

  1. Download and copy the Core, Extras(Optional) and _Demo(Optional) folders into an empty folder inside your Assets directory
  2. Add a serialized behLists.BehaviourList variable to any of your scripts to create a new Behaviour List
  3. In your script, call Init(), TickRoot() and Destroy() on your behLists.BehaviourList
  4. Configure your BehaviourList in the inspector. Create scripts with a class that inherit from ListData, BranchBehaviour and LeafCondition (In behLists namespace) if needed
  5. See _Demo/ExampleBehaviourScript.cs for code example

Documentation

Most functions are documented and all parameters visible in the Unity inspector have tooltips

See Extras/Chance.cs for LeafCondition code example

See _Demo/ExampleAiData.cs for ListData code example

See _Demo/ExampleBranchBehIdle.cs for BranchBehaviour code example

The _Demo/ folder contains more pratical exampels

License

UnityBehaviourList © 2024 by David Westberg is licensed under MIT - See the LICENSE file for more details.

About

Like a semi-visual state machine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages