Skip to main content

Track Unity Event References Across Renames

TinyGiants
Unity Games & Tools Developer

When a player-death event drives both UI and audio, both systems can listen to the same event asset. The asset reference lets you find the senders and listeners before a refactor. Check the serialized callback separately when renaming its method.

Share a typed event asset​

GES architecture

The diagram shows a sender raising an event asset and the configured listeners handling it. In Game Event Editor, create a parameterless event named OnPlayerDefeated. Assign the event to the code that detects defeat, then bind callbacks for the defeat screen and audio in Game Event Behavior.

using TinyGiants.GES.Runtime;
using UnityEngine;

public class PlayerHealth : MonoBehaviour
{
[GameEventDropdown, SerializeField] private GameEvent onPlayerDefeated;
[SerializeField] private float health = 100f;

public void TakeDamage(float damage)
{
if (health <= 0f) return;

health -= damage;
if (health <= 0f)
onPlayerDefeated.Raise();
}
}

Open the event's Event Action list and select the scene object and method for each callback. In Play Mode, reduce health to zero and verify that the configured responses run once.

Action callbacks in Game Event Behavior

Check references before a rename​

In Game Event Editor, select the event and open Event Finder. Review the scene and asset references before you change the event or the method bound to it.

Event references grouped by usage

Renaming an event in its database preserves its GES event ID. The reference from Unity to the database sub-asset also depends on the asset GUID and its local file ID. After moving or recreating a sub-asset, check the references again. If you rename a method assigned in the UnityEvent list, reselect the method where it is bound and test the callback in Play Mode.

Manage listeners during scene changes​

A scene can reuse the same event asset as another scene. Configure the scene's callbacks in Behavior or its Receiver components, and use persistent listeners for services that stay alive across the scene change. Remove a script listener when the object that owns it is disabled or destroyed.

Find event references · Configure persistent listeners