# Event Return or Delay in Function?

**URL:** <https://forums.unrealengine.com/t/event-return-or-delay-in-function/564450>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [May 23, 2022, 6:42pm UTC](https://forums.unrealengine.com/t/event-return-or-delay-in-function/564450 "2022-05-23T18:42:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![espr3ss0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@espr3ss0](https://forums.unrealengine.com/u/espr3ss0)\
**Post date:** [May 23, 2022, 6:42pm UTC](https://forums.unrealengine.com/t/event-return-or-delay-in-function/564450/1 "2022-05-23T18:42:13Z")

</div>

My aim is to run either an Event that can return a variable, or have a Function (which can) with a delay. Either way, the purpose is to know when my task has finished like a function does.

Any suggestions?

---

<div class="post-metadata">

**Author:** ![tyconner](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tyconner/32/1203517_2.png) [@tyconner](https://forums.unrealengine.com/u/tyconner)\
**Post date:** [May 23, 2022, 7:49pm UTC](https://forums.unrealengine.com/t/event-return-or-delay-in-function/564450/2 "2022-05-23T19:49:22Z")

</div>

Functions cannot have latent events.

What you’re looking for is called a Macro.

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [May 23, 2022, 9:37pm UTC](https://forums.unrealengine.com/t/event-return-or-delay-in-function/564450/3 "2022-05-23T21:37:15Z")

</div>

> [@espr3ss0](#):
>
> Either way, the purpose is to know when my task has finished like a function does.

What is the “task” here? Usually this is a case to use delegates which you can broadcast when a task is finished, instead of checking state after delay, if that is what you are trying to do.

> **[Event Dispatchers](https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/Blueprints/UserGuide/EventDispatcher/)**
>
> Allows a Blueprint Class to report on its state to the Level Blueprint.

Another way, closer to a “delay” is to run a timer from a function:  
[https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/UseTimers/](https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/UseTimers/)

---

<div class="post-metadata">

**Author:** ![eldany.uy](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/eldany.uy/32/821920_2.png) [@eldany.uy](https://forums.unrealengine.com/u/eldany.uy)\
**Post date:** [May 23, 2022, 10:56pm UTC](https://forums.unrealengine.com/t/event-return-or-delay-in-function/564450/4 "2022-05-23T22:56:43Z")

</div>

@Roy_Wierer.Seda145 is right. Your problem sounds like a Dispatcher situation.

Dig right there…you just bind some ‘i’m finished’ dispatcher to a function and when you actually finish you call it and everybody that is binded will hear and know what to do

---

<div class="post-metadata">

**Author:** ![espr3ss0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@espr3ss0](https://forums.unrealengine.com/u/espr3ss0)\
**Post date:** [May 25, 2022, 1:16pm UTC](https://forums.unrealengine.com/t/event-return-or-delay-in-function/564450/5 "2022-05-25T13:16:08Z")

</div>

Thanks for the suggestions.
