Course contentsShow
← Unity Game Development
Lesson 412 of 8286. Animation and CinemachineFree lesson

Implementing Signal Receivers for Event Handling

Configure Signal Receivers to listen for broadcasted timeline events and execute corresponding logic within your gameplay systems.

In this lesson, you will learn how to bridge the gap between your Timeline cutscenes and your gameplay scripts by configuring Signal Receivers to execute logic when an event is broadcast.

The Role of the Signal Receiver

While Signal Emitters act as the "broadcast tower" sending a message at a specific point in your Timeline, the Signal Receiver acts as the "antenna" that catches that message and tells your game what to do next. Without a receiver, a signal is essentially a message sent into a void—it triggers, but nothing happens.

Setting Up the Connection

To implement this, follow these steps:

  1. Create a Signal Asset: In your Project window, right-click and select Create > Timeline > Signal. This acts as the "channel" ID for your event.
  2. Add the Receiver: On the Game Object you want to control (e.g., a PlayerController or UIManager), add a Signal Receiver component.
  3. Define the Reaction: In the Signal Receiver, click Add Reaction. Assign your Signal Asset to the "Signal" slot, and then link the specific method you want to call in the "UnityEvent" drawer.

For example, if you have a cutscene where a boss arrives, you might call a method like this in your BossController:

public class BossController : MonoBehaviour
{
    public void ActivateBoss()
    {
        gameObject.SetActive(true);
        // Additional logic: play music, disable player input, etc.
    }
}

By dragging your BossController into the Signal Receiver’s UnityEvent slot and selecting ActivateBoss(), you ensure that the moment the Timeline reaches your Emitter, the ActivateBoss method executes instantly.

Why This Matters

This decoupled architecture is vital for clean code. Your Timeline doesn't need to know the internal workings of your BossController; it only needs to send a signal. The Signal Receiver handles the "how," allowing you to swap out gameplay systems or change reaction logic without ever touching the Timeline asset itself. It keeps your cinematic orchestration separate from your core game mechanics.

Key Takeaway: The Signal Receiver acts as the bridge between your Timeline's broadcast and your gameplay logic, allowing you to trigger specific C# methods in response to events by linking a Signal Asset to a UnityEvent.