Unreal AddDynamic() Delegate Is Not Working

There are multiple reasons why a function that was bound using AddDynamic() may not get called or appear not to work in Unreal Engine C++. This Tutorial will cover some of those scenarios and how to solve them.

Common Developer Mistakes

  1. You are not getting Delegates by reference before you call AddDynamic On Them. You should almost always get a reference to the delegate, not a copy. Example of how NOT to do it:

    FDelegateName theDelegate= getDelegateFunction();

    This is wrong and you will get a copy instead of the delegate you want to bind to. Instead, use:

    FDelegateName& theDelegate= getDelegateFunction();

    Emphasis on the ampersand sign( get by reference).

  2. The delegate is not getting Broadcast anywhere in the code. If Delegate->Broadcast is not getting called anywhere in the code, that means listeners(functions) will never get triggered. Sometimes this may be your error if its a custom delegate or a bug within the engine itself if its an engine delegate. The delegate may not have ever been called.

  3. Garbage Collection. Check if your delegate owners or broadcasters are not getting deleted on invalidated by the garbage collector. Ensure you have protected/or added them for reference counting by using UPROPERTY where appropriate.
5/5

Welcome to our audio and rhythm plugins collection! With MidiEngine, you can easily import MIDI files and use midi events to create engaging rhythm gameplay or enhance your videos.

4.5/5

Plugin that helps add UMG Widgets to Level Sequences for Text Layers, Movie Titles, 2D layers and more… directly within sequencer. Cross platform.

5/5

Let your end users Split And Resize The UI at runtime. Perfect for both games and Applications.

Consider investing in some of our plugins. They might save you some time.  Also helps supports these tutorials.

Instantly get access to our plugins like Blender Curves Importer and UMG Cinematics and more when  you support us on Patreon!

 Join Us On Discord For More Daily Tips!