This can be easily done by extending the UUserWidget
class. If you create a variable or function, and make it available to the UMG blueprint with the UPROPERTY
and UFUNCTION
macros, you should be able to use those values or call the functions normally.
There is also the need to include various dependencies into your project.
The whole process is summed up nicely here,