# Example of Removing a Dynamic Multicast Delegate?

**URL:** <https://forums.unrealengine.com/t/example-of-removing-a-dynamic-multicast-delegate/1865774>\
**Category:** C++\
**Tags:** unreal-engine, question\
**Created:** [May 21, 2024, 5:07am UTC](https://forums.unrealengine.com/t/example-of-removing-a-dynamic-multicast-delegate/1865774 "2024-05-21T05:07:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JPrecache](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JPrecache](https://forums.unrealengine.com/u/JPrecache)\
**Post date:** [May 21, 2024, 5:07am UTC](https://forums.unrealengine.com/t/example-of-removing-a-dynamic-multicast-delegate/1865774/1 "2024-05-21T05:07:23Z")

</div>

I’m trying to inform my AI characters when their target dies, so I’ve setup a delegate:

> LockedOnTarget-\>EventOnFMCharacterDeath.AddDynamic(this, &AFMPlayableCharacter::OnTargetDeath);

This works fine, and I can use this:

> LockedOnTarget-\>EventOnFMCharacterDeath.RemoveAll(this);

But

> LockedOnTarget-\>EventOnFMCharacterDeath.Contains(this, &AFMPlayableCharacter::OnTargetDeath)

and

> LockedOnTarget-\>EventOnFMCharacterDeath.Remove(this, &AFMPlayableCharacter::OnTargetDeath)

Give cryptic compiler errors . Does anyone have an example of how to use these?

---

<div class="post-metadata">

**Author:** ![Sitiana](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sitiana/32/1194605_2.png) [@Sitiana](https://forums.unrealengine.com/u/Sitiana)\
**Post date:** [May 21, 2024, 8:23am UTC](https://forums.unrealengine.com/t/example-of-removing-a-dynamic-multicast-delegate/1865774/2 "2024-05-21T08:23:11Z")

</div>

Hello, if you use “AddDynamic” macro to add delegare, you can also use “RemoveDynamic” to remove delegate and “IsAlreadyBound” as equivalent of “Contains”. Functions “Remove” and “Contains” require function as FName, not pointer to member as those macros.

So your code could have these 2 forms…

Using macros:

```auto
LockedOnTarget->EventOnFMCharacterDeath.IsAlreadyBound(this, &AFMPlayableCharacter::OnTargetDeath)
LockedOnTarget->EventOnFMCharacterDeath.RemoveDynamic(this, &AFMPlayableCharacter::OnTargetDeath)

```

Using functions:

```auto
LockedOnTarget->EventOnFMCharacterDeath.Contains(this, FName("OnTargetDeath"))
LockedOnTarget->EventOnFMCharacterDeath.Remove(this, FName("OnTargetDeath"))

```

Both versions compile fine on my end.
