> For the complete documentation index, see [llms.txt](https://asperazera.gitbook.io/ultimate-event-system/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://asperazera.gitbook.io/ultimate-event-system/advanced/unsubscribing.md).

# Unsubscribing & Lifecycle

Sometimes a subscriber should stop reacting - an actor dies, a menu closes, a phase ends. Here are the ways to stop receiving events, from "it's automatic" to "wipe everything."

***

### 1. Automatic Cleanup (Destroyed Objects)

**Best for:** dead enemies, destroyed items, level transitions.

UES tracks subscribers with **weak references**, so it never keeps a destroyed object alive. When an object is gone, its callbacks are skipped, and a background timer prunes the stale entries automatically.

{% hint style="info" %}
**You won't crash or leak** if you forget to unsubscribe a destroyed actor. Still, explicit cleanup (below) frees the slot immediately instead of waiting for the timer - it's the recommended habit.
{% endhint %}

***

### 2. The Unsubscribe Node

<figure><img src="/files/T4GGYCydALUC1j8KVavN" alt=""><figcaption></figcaption></figure>

**Best for:** clean teardown on **End Play** / **Destroyed**, or dropping specific topics at runtime.

Use the **Unsubscribe** node (category **UES**). It works on a **Subscriber** object (defaults to `Self`) - you don't need to store any handle from when you subscribed.

#### Mode A - Unsubscribe from Specific Tags

1. Leave **Unsubscribe from All Events** as `False`.
2. In the **Events** pin, tick the tags you want to drop.
3. The subscriber keeps listening to everything else.

#### Mode B - Unsubscribe from Everything (recommended for cleanup)

1. Set **Unsubscribe from All Events** to `True` (the `Events` pin hides).
2. Call it on **Event End Play** or **Event Destroyed**.

This removes *all* of the subscriber's bindings in one call.

<figure><img src="/files/Y6zDDnimBtRnCCfov5ZI" alt=""><figcaption></figcaption></figure>

***

### 3. Logical "Mute" (Boolean Gate)

**Best for:** temporarily ignoring events (player is stunned) without touching the subscription.

Keep the subscription, but gate your logic with a variable:

1. Add a Boolean like `bIsListening` to your Blueprint.
2. Right after the callback, add a **Branch** driven by that boolean.
3. `True` → run your logic. `False` → do nothing.

This "mutes" the reaction while keeping the connection intact - flip the boolean to resume instantly.

***

### 4. Remove All Subscriptions from Events (Global Reset)

<figure><img src="/files/LvLltUYJMaKxDh5YSBIe" alt=""><figcaption></figcaption></figure>

**Best for:** resetting game managers between rounds/phases - clearing *everyone's* subscription on chosen tags at once.

The **Remove All Subscriptions from Events** node (category **UES → Utilities**) is a broadcast-wide reset, not a per-object tool.

* **Selected tags (default):** set **Clear All Events** to `False` and list the tags in **Events**. Enable **Include Child Tags** to also clear children (clearing `Event.Player` would also clear `Event.Player.Death`, `Event.Player.Spawn`, …).
* **Everything:** set **Clear All Events** to `True` to wipe every subscription in the game.

{% hint style="warning" %}
**This affects every object in the game**, not just this Blueprint. To remove one object's subscription, use the **Unsubscribe** node instead.
{% endhint %}

***

### Summary

| Method                       | When to use it                                          |
| ---------------------------- | ------------------------------------------------------- |
| **Automatic Cleanup**        | The object gets destroyed - handled for you.            |
| **Unsubscribe (All)**        | Clean teardown on End Play / Destroyed.                 |
| **Unsubscribe (Tags)**       | Drop specific topics but keep listening to others.      |
| **Boolean Gate**             | Temporarily mute reactions without unsubscribing.       |
| **Remove All Subscriptions** | Global reset - clears *all* subscribers on chosen tags. |
