A modular trigger flow system package for Unity to easily customize and reuse trigger logics.
TriggerFlow is a flexible and reusable trigger system built for Unity using ScriptableObjects. It allows you to define trigger behavior through modular constraint and action blocks, making your gameplay logic clean, configurable, and easy to extend.
- Modular trigger flow architecture
- Customizable constraint and action system
- Easily composable and reusable trigger assets
To install via Git URL:
- Open Unity → Window > Package Manager
- Click the
+button → Add package from git URL... - Paste the URL:
https://github.com/FLwolfy/TriggerFlow.git - Click Add and wait for the package to import.
- Attach a
TriggerControllercomponent to any GameObject with aColliderset toIsTrigger = true. - Assign one or more
TriggerFlowassets to it.
- Right-click in the Project panel →
Create > Trigger > TriggerFlow - Choose the trigger event:
OnTriggerEnter,OnTriggerStay, orOnTriggerExit - Add constraints and actions using the inspector
The system works like this:
When the trigger event occurs:
- All
TriggerConstraintobjects are evaluated viaOnCheck(Collider other)- If all constraints return
true, allTriggerActions are executed viaOnPerform(Collider other)
You can create your own custom constraints and actions by inheriting from the following abstract classes:
public abstract class TriggerConstraint
{
// Return true to pass the constraint
public abstract bool OnCheck(Collider other);
}public abstract class TriggerAction
{
// Execute the action in detail
public abstract void OnPerform(Collider other);
}To try out an example setup:
- Open Unity → Package Manager
- Find TriggerFlow in the list
- Expand the Samples section
- Click Import on the "Basic Trigger Example"
The sample includes a test scene, a tag constraint, and a debug action.
This is just a simple basic trigger system inspired by the behavior system in my javafx engine development. If you find this useful, please leave a ⭐, and feel free to extend more!