So when the function Then() is started, is function Start() already finished? Or the program is still in scope of function Start()? I read the documentation of delegates, and I assume it is some kind of function pointer. But I still need to confirm this assumption.
You are correct that the idea of adding bound functions to a list to be called later is not an accurate description of how broadcasting works in Unreal Engine or other similar systems.
In Unreal Engine, broadcasting is a synchronous operation where the bound functions are executed immediately in the order they were added to the delegate. As your test demonstrates, the bound function is executed before the log message after the broadcast call, which confirms that the execution of the function is not deferred to a later time.
It’s possible that the confusion may arise from the fact that delegates in Unreal Engine can support both synchronous and asynchronous invocation, depending on the type of delegate used. For example, a multicast delegate supports synchronous invocation, while a dynamic delegate supports asynchronous invocation.
Therefore, it’s important to distinguish between the different types of delegates and their invocation behavior when discussing broadcasting in Unreal Engine.
Where does that idea come from? Feel free to prove me wrong, but as far as I’m aware this has never been the case. It’s not the first time I hear about it though.
I just did a simple test to make sure I’m not crazy (UE5.1) :