Decoupling Unity Systems With Events, Minus the Spaghetti
Events can untangle a Unity project, or hide the tangle somewhere harder to debug. Here is how to pick the right kind of event and keep the wiring readable as the game grows.

A clean Unity event system architecture uses events only between systems that should not know about each other, such as gameplay talking to UI, audio, or analytics. Use plain C# events inside code, UnityEvents for designer wiring in the Inspector, and ScriptableObject event channels across scenes. Always unsubscribe in OnDisable, and keep a list of every event.
Why events help, and when they hurt
When your player script calls the UI, the audio manager, and the analytics service directly, every one of those becomes a dependency. Change one, and the player script breaks.
Events flip that. The player says "I took damage", and anyone who cares listens. The player never needs to know who that is.
The catch is that events hide the call path. Too many, and you end up with code where nothing obviously calls anything, which is spaghetti of a different shape.
The four options, compared
| Option | Best for | Watch out for |
|---|---|---|
| Direct reference | Parts of the same feature, same prefab | Grows into a web if used across systems |
| C# event or Action | Code-to-code signals inside a system or between services | Must unsubscribe, invisible in Inspector |
| UnityEvent | Designer wiring in the Inspector, buttons, triggers | Slower, hard to search, easy to break by renaming |
| ScriptableObject event channel | Cross-scene and cross-system signals | Asset sprawl if every tiny signal gets one |
Direct references are fine more often than people think. If two scripts live on the same prefab and always ship together, a serialized reference is the most readable choice.
C# events for code-to-code signals
The simplest version is a C# event on the component that owns the change.
public class Health : MonoBehaviour
{
public event System.Action<int, int> Changed; // current, max
[SerializeField] int max = 100;
int current;
void Awake() => current = max;
public void Damage(int amount)
{
current = Mathf.Max(0, current - amount);
Changed?.Invoke(current, max);
}
}
A health bar subscribes in OnEnable and unsubscribes in OnDisable. It still needs a reference to the Health component, but Health knows nothing about the bar.
ScriptableObject event channels for cross-system signals
When the sender and receiver live in different scenes, or you want to swap listeners without touching code, a ScriptableObject channel works well. Unity's own open project samples used this pattern.
[CreateAssetMenu(menuName = "Events/Int Event Channel")]
public class IntEventChannel : ScriptableObject
{
public event System.Action<int> Raised;
public void Raise(int value) => Raised?.Invoke(value);
}
public class CoinCounterUI : MonoBehaviour
{
[SerializeField] IntEventChannel coinsChanged;
[SerializeField] TMPro.TMP_Text label;
void OnEnable() => coinsChanged.Raised += Show;
void OnDisable() => coinsChanged.Raised -= Show;
void Show(int coins) => label.text = coins.ToString();
}
Create the asset with Assets > Create > Events > Int Event Channel, then drag it into both the sender and the listener. Neither knows the other exists.
Unity cannot create assets from an open generic type, so if you write a generic base class, make a small concrete subclass for each payload type.
Habits that keep events readable
Name events in the past tense
CoinsChanged, LevelCompleted, PlayerDied. Past tense says "this happened", which keeps events as notifications rather than commands.
Keep commands as direct calls
If one system needs another to do something and wants a result, call it. Events are for "this happened, react if you like", not "please do this and tell me how it went".
Always unsubscribe
Subscribe in OnEnable, unsubscribe in OnDisable. Forgetting causes listeners on destroyed objects, which shows up as MissingReferenceException errors or quiet memory growth.
Watch out with domain reload off
If you disable domain reload under Edit > Project Settings > Editor > Enter Play Mode Settings, static events keep their subscribers between play sessions. Reset them explicitly.
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
static void ResetStatics() => GameEvents.ClearAll();
ScriptableObject channels have the same issue in the editor, since assets are not reset between play sessions. Unsubscribing in OnDisable handles it.
Make events debuggable
The main cost of events is that you cannot follow them with Go To Definition. Win that back with a few small tools.
- Log on raise in development builds, with the sender's name.
- Show listener count in a custom inspector for each channel asset.
- Keep one folder for all channel assets, so the full list of events is visible at a glance.
- Write a one-line comment on every event saying who raises it.
If you cannot list every event in your game from memory or from one folder, you have too many. Merge or delete before adding another.
These pair well with ScriptableObjects for game config, since both keep data and wiring out of scene objects.
A rule of thumb for small teams
- Same feature, same prefab: direct reference.
- Code service to code service: C# event.
- Designer hooks up a button or a trigger: UnityEvent.
- Gameplay to UI, audio, analytics, or across scenes: ScriptableObject channel.
Two or three patterns in a project is plenty. Mixing all four everywhere is how the spaghetti comes back.
What we would do
We would start with direct references and C# events, and only add ScriptableObject channels where systems cross scenes or need swappable listeners. Gameplay to UI, audio, and analytics is usually where they earn their place.
We would name every event in past tense, keep channel assets in one folder, log raises in dev builds, and review the event list whenever it grows past what one person can hold in their head.
The short version
- Good Unity event system architecture uses events only between systems that should not know about each other.
- Direct references are fine inside a feature. Events are for crossing boundaries.
- C# events for code, UnityEvents for designers, ScriptableObject channels across scenes.
- Name events in past tense, keep commands as direct calls, and always unsubscribe.
- Add logging and listener counts so events stay debuggable.
If your project's wiring has turned into a mystery, we are happy to take a look.
Related reading: Building a modular item system in Unity, A Unity save system guide, Animation state machines at scale
Got a game idea? We build it.
You bring the concept. We design, build, test and launch it, and you own 100% of the finished game.
Share Your Game Idea →