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.
- 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
Requirements (Should work in other versions and render pipelines)
- Unity 2023.2.20f1 (Built-in)
General Setup
- Download and copy the
Core
,Extras(Optional)
and_Demo(Optional)
folders into an empty folder inside yourAssets
directory - Add a serialized
behLists.BehaviourList
variable to any of your scripts to create a new Behaviour List - In your script, call Init(), TickRoot() and Destroy() on your behLists.BehaviourList
- Configure your BehaviourList in the inspector. Create scripts with a class that inherit from
ListData, BranchBehaviour and LeafCondition
(In behLists namespace) if needed - See
_Demo/ExampleBehaviourScript.cs
for code example
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
UnityBehaviourList © 2024 by David Westberg is licensed under MIT - See the LICENSE
file for more details.