Raising Game Event
After creating and configuring events, the final step is triggering them in your game logic. This page shows how Game Events work and how to raise them in your scripts.
- β Create events β Game Event Creator
- β Configure actions β Game Event Behavior
- β Raise events β You are here
π― How Game Events Workβ
Game Events decouple event raising from action execution:
Traditional Approach:
// β Tightly coupled - door logic knows about sound, animation, etc.
public class Door : MonoBehaviour
{
public AudioSource audioSource;
public Animator animator;
public UIManager uiManager;
public void Open()
{
audioSource.Play();
animator.SetTrigger("Open");
uiManager.ShowNotification("Door opened");
// Logic scattered across multiple dependencies
}
}
Game Event Approach:
// β
Decoupled - door only knows "something happened"
public class Door : MonoBehaviour
{
[GameEventDropdown]
public GameEvent onDoorOpened;
public void Open()
{
onDoorOpened.Raise(); // Actions configured in Inspector
}
}
Key Difference: Actions (sound, animation, UI) are configured visually in Event Behavior, not hardcoded in scripts.
π Basic Usage: Raising Eventsβ
Step 1: Reference the Event in Your Scriptβ
using TinyGiants.GameEventSystem.Runtime;
using UnityEngine;
public class DoorController : MonoBehaviour
{
[GameEventDropdown] // Smart Inspector picker
public GameEvent onDoorOpened;
[GameEventDropdown]
public GameEvent onDoorClosed;
public void OpenDoor()
{
// Your door logic here
onDoorOpened.Raise(); // Trigger the event
}
public void CloseDoor()
{
// Your door logic here
onDoorClosed.Raise();
}
}
Step 2: Assign Event in Inspectorβ
The [GameEventDropdown] attribute provides a type-safe searchable dropdown:

Features:
- π Fuzzy Search: Type to filter events by name
- π Categorized: Events grouped by database and category
- π Type Safety: Only shows compatible event types
- β‘ Quick Access: No manual asset dragging needed
Alternative: Without [GameEventDropdown]β
You can also use a standard public field:
public GameEvent onDoorOpened; // Standard ScriptableObject field
Inspector View:

Workflow:
- Locate event asset in Project window (Event Database)
- Drag & drop into Inspector field
Recommendation: Use [GameEventDropdown] for better workflowβit's faster and type-safe.
π¨ Typed Events (With Arguments)β
Events can carry data to actions.
Void Events (No Data)β
[GameEventDropdown]
public GameEvent onGameStart;
void Start()
{
onGameStart.Raise(); // No arguments
}
Single Argument Eventsβ
[GameEventDropdown]
public GameEvent<float> onHealthChanged;
private float health = 100f;
public void TakeDamage(float damage)
{
health -= damage;
onHealthChanged.Raise(health); // Pass current health value
}
Type Safety: Dropdown only shows GameEvent<float> events, preventing type mismatches.
Sender + Argument Eventsβ
[GameEventDropdown]
public GameEvent<GameObject, DamageInfo> onPlayerDamaged;
public void ApplyDamage(DamageInfo damageInfo)
{
// Sender = this GameObject, Args = damage info
onPlayerDamaged.Raise(this.gameObject, damageInfo);
}
Use Case: Actions need to know who triggered the event and what data to process.
π Type Safety in Actionβ
The dropdown automatically filters events based on field type:
public class ScoreManager : MonoBehaviour
{
[GameEventDropdown]
public GameEvent<int> onScoreChanged; // Only shows GameEvent<int>
[GameEventDropdown]
public GameEvent<int> onLevelUp; // Only shows GameEvent<int>
private int score = 0;
public void AddScore(int points)
{
score += points;
onScoreChanged.Raise(score); // Pass integer score
}
}
Dropdown Filtering:
Available Events for GameEvent<int>:
β
OnScoreChanged (int)
β
OnLevelUp (int)
β
OnComboMultiplier (int)
β OnPlayerDeath (void) β Filtered out (wrong type)
β OnDamage (float) β Filtered out (wrong type)
Why This Matters: Catches type errors at edit time, not runtime.
π Canceling Scheduled Eventsβ
If your event uses delay or repeat settings (configured in Game Event Behavior), you can cancel execution:
[GameEventDropdown]
public GameEvent repeatingSoundEvent;
void StartAmbientSound()
{
repeatingSoundEvent.Raise(); // Starts repeating (based on Behavior config)
}
void StopAmbientSound()
{
repeatingSoundEvent.Cancel(); // Stops scheduled execution
}
Use Cases:
- Player leaves trigger zone β Cancel ambient sounds
- Game paused β Cancel timed events
- Object destroyed β Cleanup scheduled actions
π§ Advanced: Inspector Listener Controlβ
Rarely needed, but you can disable Inspector-configured actions at runtime:
[GameEventDropdown]
public GameEvent myEvent;
void DisableCutsceneUI()
{
myEvent.SetInspectorListenersActive(false);
// Inspector actions won't fire, only code listeners
}
void EnableCutsceneUI()
{
myEvent.SetInspectorListenersActive(true);
// Inspector actions fire again
}
Use Cases:
- Temporarily disable UI updates during cutscenes
- Switch between action sets based on game state
π‘ Complete Workflow Exampleβ
Let's build a complete door system using the visual workflow.
Step 1: Create Eventsβ

- Create
OnDoorOpened(void event) - Create
OnDoorClosed(void event)
Step 2: Configure Actionsβ

OnDoorOpened Event:
- Action:
AudioSource.PlayOneShot(doorOpenSound) - Action:
Animator.SetTrigger("Open") - Action:
ParticleSystem.Play()(dust effect)
OnDoorClosed Event:
- Action:
AudioSource.PlayOneShot(doorCloseSound) - Action:
Animator.SetTrigger("Close")
Step 3: Write the Scriptβ
using TinyGiants.GameEventSystem.Runtime;
using UnityEngine;
public class DoorController : MonoBehaviour
{
[GameEventDropdown]
public GameEvent onDoorOpened;
[GameEventDropdown]
public GameEvent onDoorClosed;
private bool isOpen = false;
public void ToggleDoor()
{
if (isOpen)
{
isOpen = false;
onDoorClosed.Raise(); // All actions fire automatically
}
else
{
isOpen = true;
onDoorOpened.Raise(); // All actions fire automatically
}
}
// This method can be called from:
// - Button OnClick in Inspector
// - Collision/Trigger detection
// - Other game systems
}
Step 4: Assign Events in Inspectorβ

- Select
DoorControllerGameObject - Use dropdown to assign
OnDoorOpenedevent - Use dropdown to assign
OnDoorClosedevent
Done! No sound, animation, or VFX references in scriptβall configured visually.
π Why Better Than UnityEvents?β
Traditional UnityEvent approach has limitations that Game Events solve:
Traditional UnityEvent Limitationsβ
// β Problem 1: Configuration scattered across many GameObjects
public class Button1 : MonoBehaviour
{
public UnityEvent onClick; // Configured in Button1's Inspector
}
public class Button2 : MonoBehaviour
{
public UnityEvent onClick; // Configured in Button2's Inspector
}
// β Problem 2: Hard to find all usages
// Need to manually search every GameObject in scene
// β Problem 3: No central control
// Can't globally enable/disable button sounds
// β Problem 4: Duplication
// Same sound/VFX setup repeated in 50 buttons
Game Event Advantagesβ
// β
Solution: All buttons raise the same event
public class ButtonController : MonoBehaviour
{
[GameEventDropdown]
public GameEvent onButtonClick; // Same event for all buttons
public void OnClick()
{
onButtonClick.Raise();
}
}
Benefits:
| Feature | UnityEvent | Game Event |
|---|---|---|
| Centralized Config | β Per GameObject | β One Event Behavior |
| Find All Usage | β Manual search | β Event Finder |
| Global Control | β Change 50 objects | β Change one event |
| Reusability | β Copy-paste | β Reference same asset |
| Conditional Logic | β Code required | β Visual condition tree |
| Debugging | β Inspector only | β Flow Graph visualization |
When to Use Eachβ
Use UnityEvents:
- Simple one-off callbacks (e.g., tutorial button)
- Component-specific logic (e.g., slider updates its own label)
- No need for reusability
Use Game Events:
- Reusable logic (e.g., all button clicks play same sound)
- Complex sequences (e.g., cutscenes, door puzzles)
- Need central control (e.g., mute all UI sounds)
- Want visual debugging (Flow Graph)
β Troubleshootingβ
Dropdown Shows "Manager Missing"β
Cause: No GameEventManager in scene.
Solution:
Open Game Event System via the Unity toolbar:
Tools > TinyGiants > Game Event System
Click the "Initialize Event System" button, creating a Game Event Manager GameObject (Singleton) in your scene.
Dropdown Shows "No Active Databases"β
Cause: No databases assigned in GameEventManager.
Solution:
- Select
GameEventManagerin scene - Inspector β Databases section
- Add your event databases
Dropdown Shows "No Matching Events"β
Cause: No events match the field type.
Example:
[GameEventDropdown]
public GameEvent<string> textEvent; // Needs GameEvent<string>
// But your databases only have:
// - GameEvent (void)
// - GameEvent<int>
// - GameEvent<float>
Result: No matching events!
Solution: Create events of the correct type using Game Event Creator.
Event Doesn't Fireβ
Checklist:
- β Is event asset assigned in Inspector?
- β
Is
Raise()being called? (add Debug.Log to verify) - β Are actions configured in Game Event Behavior?
- β Are conditions passing? (check condition tree)
- β Is GameEventManager in scene?
You've now learned the complete visual workflow:
- β Create events in Event Creator
- β Configure actions in Event Behavior
- β
Raise events with UnityEvents or
GameEventDropdown
Result: Decoupled, maintainable, designer-friendly game logic!
This page covers visual workflow (raising events in scripts with Inspector assignment). For advanced code techniques (runtime listeners, conditional triggers, event chains), see Runtime API.