What exactly is "a Dynamic Event". OnOverlapBegin(....) why must be UFUNCTION

Hi all.

Just working through this video and I see that the function implementation from my title must be a UFUNCTION. But I am not understanding the explanation. Sam has just said “because it is a dynamic event” but does that really mean anything? Surely lots of other functions are ‘dynamic events’ which are not UFUNCTIONS (for example if I made a Sword Swing animation function is this not dynamic also?)

Does anyone know why exactly this must be UFUNCTION? I hate to move on without understanding why a certain piece of code is there.

Thanks for any help

1 Like

Dynamic Events are events that are bound in code to things like key presses, timers and so on. UFUNCTION has many other uses like making methods blueprint callable so you can use your C++ code from Blueprint - an incredibly useful feature. It does this via Unreal’s reflection system.

The Engine, which uses reflection, is C++ which is precompiled and it needs to call C++ code it is unaware of i.e. your code that you are writing. The UFUNCTION is a macro that marks the given functions with prefixes that allows the engine to see this code without knowing about it at engine compile time and most people download a precompiled engine. This is why it is referred to as dynamic because you’re effectively extending the engine with your own code at runtime.

See the Unreal Docs Page which has a good explanation of the UFUNCTION()
UFunctions | Unreal Engine Documentation

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms