# How to bind event to event?

**URL:** <https://forums.unrealengine.com/t/how-to-bind-event-to-event/640920>\
**Category:** C++\
**Tags:** UE4-20, unreal-engine, UE4, question, CPP\
**Created:** [September 4, 2022, 4:27am UTC](https://forums.unrealengine.com/t/how-to-bind-event-to-event/640920 "2022-09-04T04:27:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexa.Ki](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alexa.ki/32/562753_2.png) [@Alexa.Ki](https://forums.unrealengine.com/u/Alexa.Ki)\
**Post date:** [September 4, 2022, 4:27am UTC](https://forums.unrealengine.com/t/how-to-bind-event-to-event/640920/1 "2022-09-04T04:27:47Z")

</div>

Hi! I want to bind event to event in C++ , how to do it?

I am trying this but but on clicking play button the engine crashed.

```auto
for (auto& Arr_Elem: PickupItems)
{
  Arr_Elem->Event_OnBeginOverlap.AddDynamic(this, &AMyClass::ExecBeginOverlap);
  Arr_Elem->Event_OnEndOverlap.AddDynamic(this, &AMyClass::ExecEndOverlap);
}

```

blueprint exmp

 ![226](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/4/7/e47fab6a2895126fedf8e6775b7c4206de63a8d2.png)

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [September 4, 2022, 6:20am UTC](https://forums.unrealengine.com/t/how-to-bind-event-to-event/640920/2 "2022-09-04T06:20:22Z")

</div>

If this code compiles, it means you have declared the delegates and Binding to events ExecBeginOverlap and ExecEndOverlap functions have correct parameters in them.

If the engine crashes, it probably has something to do with null pointers, not the bindings themselves. Probably one or more of the array elements are nullptr, check them first before binding to events.

And if anything, test a more explicit for loop — use the actual class name instead of auto, like:  
`for (AMyPickupItem* item : PickupItems)`

---

<div class="post-metadata">

**Author:** ![Alexa.Ki](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alexa.ki/32/562753_2.png) [@Alexa.Ki](https://forums.unrealengine.com/u/Alexa.Ki)\
**Post date:** [September 4, 2022, 9:20am UTC](https://forums.unrealengine.com/t/how-to-bind-event-to-event/640920/3 "2022-09-04T09:20:54Z")

</div>

I hve double checked, the array is not nulled, and I created native code from a working blueprint which looks like it.

```auto
MyOverLapDelegate.BindUFunction(this,FName(TEXT("ExecBeginOverlap")));
FCustomThunkTemplates::Array_Get(PickupItems, Array_Index, /*out*/ Array_Elements);
if(::IsValid(Array_Elements))
{
	Array_Elements->OnBeginOverlap.AddUnique(MyOverLapDelegate);
}

```
