Trigger Nodes
Trigger nodes 🟧 are the entry points of every animation graph — they initiate animation sequences when specific conditions are met. Without a trigger node, your graph cannot execute.
Color Coding: Green (🟧) — easily identifiable as entry points
Overview
- Purpose: Start animation sequences based on events, user input, or system conditions
- Execution: Autonomous — no input connections needed
- Outputs: One or more output ports for connecting to animation nodes
- Activation: Based on Unity events, user input, timers, or custom logic
Common Characteristics:
- No Input Ports: Triggers don't receive execution from other nodes
- Autonomous: Act independently based on their specific conditions
- Event-Driven: React to Unity events, user actions, or system changes
- Reusable: Same trigger type can be used multiple times in different graphs
Trigger Lifecycle:
Trigger Detected → Node Activated → Connected Animations Execute → Graph Continues
Triggers monitor for their specific conditions (button click, key press, timer, etc.). When the condition is met, the trigger activates and sends execution to connected nodes, which then execute their animations.
Quick Reference Table
| Trigger Type | Use Case | Typical Target |
|---|---|---|
| On Start | Scene intro, automatic animations | UI panels, intro sequences |
| On Button Click | Menu interactions, UI feedback | Button component |
| On Key Press | Input shortcuts, debug controls | Keyboard keys |
| On Custom Event | Code integration, game events | Event name string |
| On Enable | Object lifecycle, reusable animations | GameObject active state |
| On Disable | Cleanup sequences, exit effects | GameObject inactive state |
| On Trigger Zone | 3D proximity, collisions | Collider component |
| On Timer | Delayed sequences, looping effects | Time duration |
| On API Call | Advanced integration, direct control | Code API calls |
On Start
Purpose: Triggers automatically when the scene starts or the GameObject becomes active
📘 Key Uses:
- Menu panels appearing on scene load
- Game opening animations
- HUD elements fading in
- Opening cinematics
Configuration:
| Parameter | Type | Default | Description |
|---|---|---|---|
| Startup Delay | float | 0.5s | Delay before trigger fires (prevents false triggers) |
| Fire Once | bool | true | Whether trigger fires only once or repeatedly |
Settings Explained:
- Startup Delay: Prevents false triggers when Unity starts. Recommended: 0.5-1.0 seconds
- Fire Once: When enabled, trigger fires once and stops. When disabled, can fire repeatedly if GameObject is disabled/re-enabled
Example Use:
On Start (0.5s delay, Fire Once)
↓
Fade In (Menu Panel)
↓
Play Audio (Background Music)
Best Practices:
- Use startup delay to avoid false triggers during Unity initialization
- Enable "Fire Once" for one-time intro animations
- Combine with delay nodes for precise timing control
On Button Click
Purpose: Triggers when a UI Button is clicked
📘 Key Uses:
- Menu navigation
- Gameplay triggers
- Button feedback animations
- Screen transitions
Configuration:
| Parameter | Type | Default | Description |
|---|---|---|---|
| Target Button | Button | null | The UI Button component to monitor |
Button Assignment:
- Select the trigger node in GraphFlow Editor
- In Inspector, find Target Button field
- Drag a Button GameObject from Hierarchy into the field
- Or click circle icon to select from scene
- Button is automatically connected on assignment
Setup Requirements:
- Button must have
Buttoncomponent (Unity UI) - Button must be in active Canvas hierarchy
- EventSystem must exist in scene
Example Use:
On Button Click (Target: "Play Button")
↓
Fade Out (Current Screen)
↓
Fade In (Game Screen)
Best Practices:
- Assign button reference in Inspector before testing
- Test with actual button clicks, not just code triggers
- Use button name for debugging ("Button: PlayButton, Active: True")
On Key Press
Purpose: Triggers when a specific keyboard key is pressed
📘 Key Uses:
- Debug controls
- Cheat codes
- Testing shortcuts
- Accessibility inputs
Configuration:
| Parameter | Type | Default | Description |
|---|---|---|---|
| Key | KeyCode | Space | Keyboard key to monitor for presses |
Key Selection:
- Click Key dropdown in Inspector
- Choose from all Unity KeyCode options
- Common choices: Space, Enter, Escape, Alpha1-9, etc.
Example Use:
On Key Press (Key: Space)
↓
Fade In (HUD)
↓
Play Audio (UI Sound)
Platform Notes:
- Desktop: Full keyboard support
- Mobile: Not applicable (use On Button Click instead)
- Console: Limited to controller button mappings
Best Practices:
- Use for debug/testing shortcuts
- Provide alternative UI buttons for accessibility
- Test key responsiveness after startup delay
On Enable / On Disable
On Enable: Triggers when the GameObject becomes active/enabled
On Disable: Triggers when the GameObject becomes inactive/disabled
📘 Key Uses:
- Reusable animations
- Respawn effects
- Dynamic UI panels
- State transitions
- Cleanup sequences
- Exit effects
Configuration:
No configurable parameters — Automatically detects enable/disable state
How It Works:
- GraphExecutor monitors GameObject active state
- When GameObject becomes active/inactive, trigger fires
- Works with GameObject.SetActive() calls
Example Use:
On Enable
↓
Scale Up (UI Panel)
↓
Fade In (Content)
Best Practices:
- Use for objects that are frequently enabled/disabled
- Combine with On Disable for complete lifecycle management
- Test enable/disable cycles for expected behavior
On Trigger Zone
Purpose: Triggers when collision/trigger events occur (collision-based triggers)
📘 Key Uses:
- Proximity detection
- Interaction zones
- Area-based events
- 3D interactions
Configuration:
| Parameter | Type | Default | Description |
|---|---|---|---|
| Required Tag | string | "" | Tag that colliding object must have |
| Check Tag | bool | false | Whether to filter by tag |
| Trigger On Enter | bool | true | Fire when collider enters trigger |
| Trigger On Exit | bool | false | Fire when collider exits trigger |
| Trigger Zone | Collider | null | The trigger collider to monitor |
Setup Requirements:
-
Create Trigger Zone:
- Add Collider component to GameObject
- Check "Is Trigger" checkbox
- Set appropriate size and position
-
Configure Trigger:
- Assign Collider to Trigger Zone field in Inspector
- Set Required Tag if tag filtering needed
- Enable Trigger On Enter or Trigger On Exit
-
Tag Objects:
- Apply matching tag to objects that should trigger
Example Use:
On Trigger Zone (Tag: "Player", Enter: true)
↓
Scale Up (Sign Post)
↓
Play Audio (Area Music)
Best Practices:
- Use tags for precise object filtering
- Test trigger zones with target objects
- Optimize collider sizes for performance
- Use layer-based filtering for complex scenes
On Timer
Purpose: Triggers after a specified time delay (time-based triggers)
📘 Key Uses:
- Delayed sequences
- Looping effects
- Timed events
- Cutscene pacing
Configuration:
| Parameter | Type | Default | Description |
|---|---|---|---|
| Delay Time | float | 1.0s | Time to wait before firing |
| Loop Timer | bool | false | Whether to repeat after delay |
| Use Unscaled Time | bool | false | Use Time.unscaledTime instead of Time.time |
Settings Explained:
- Delay Time: Duration in seconds before trigger fires
- Loop Timer: When enabled, trigger repeats every
Delay Timeseconds - Use Unscaled Time: Ignores Time.timeScale (useful for pause/resume)
Example Use:
On Timer (Delay: 3s, Loop: false)
↓
Fade In (Warning Message)
Looping Example:
On Timer (Delay: 5s, Loop: true)
↓
Play Audio (Ambient Loop)
Time Scale Behavior:
- Use Unscaled Time = false: Affected by Time.timeScale (pause pauses timer)
- Use Unscaled Time = true: Ignores Time.timeScale (timer continues when paused)
Best Practices:
- Use loop timers for ambient/repeating effects
- Use unscaled time for UI elements that should work during pause
- Combine with other triggers for complex timing sequences
On Custom Event
Purpose: Triggers programmatically via event-name API calls