# How can I bind an event to a dispatcher in a function or a macro?

**URL:** <https://forums.unrealengine.com/t/how-can-i-bind-an-event-to-a-dispatcher-in-a-function-or-a-macro/417852>\
**Category:** Community & Industry Discussion\
**Tags:** dispatcher, binding, macros, unreal-engine, delegates, functions, question\
**Created:** [February 20, 2018, 3:21pm UTC](https://forums.unrealengine.com/t/how-can-i-bind-an-event-to-a-dispatcher-in-a-function-or-a-macro/417852 "2018-02-20T15:21:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_5097d118](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5097d118](https://forums.unrealengine.com/u/anonymous_user_5097d118)\
**Post date:** [February 20, 2018, 3:21pm UTC](https://forums.unrealengine.com/t/how-can-i-bind-an-event-to-a-dispatcher-in-a-function-or-a-macro/417852/1 "2018-02-20T15:21:25Z")

</div>

I need to bind a lot of functions to 4-5 dispatchers all over the project, and it’s really easy to get huge spaghetti if I can’t have all the delegate references going in the same function/macro/event.

Functions don’t accept delegates, and I can’t seem to be able to bind objects in a macro.

Any C++ implementation that wouldn’t affect the hierarchy of my blueprints possible?

Any other solution possible?

![231291-capture.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/f/3/df383b58b3139800ede60712395cbded64f16422.jpeg)

In the image you can see that a function doesn’t accept delegates, they are always null.

---

<div class="post-metadata">

**Author:** ![Raz1789](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Raz1789](https://forums.unrealengine.com/u/Raz1789)\
**Post date:** [August 10, 2018, 7:21pm UTC](https://forums.unrealengine.com/t/how-can-i-bind-an-event-to-a-dispatcher-in-a-function-or-a-macro/417852/2 "2018-08-10T19:21:43Z")

</div>

Hi I think this was solved in this forum.

> **[Why I can't I directly bind a function to a button's OnClicked event?](https://forums.unrealengine.com/questions/343367/why-i-cant-i-directly-bind-a-function-to-a-buttons.html)**
>
> I have a function that generates an unknown number of buttons at runtime, and I’m trying to initialize each button by binding it’s OnClicked event to the DisplayInformation function I want to run every time that button is clicked: ...
