Modal dialog box from C++

First of all UMG is just a wrapper for Slate… and even Slate does not have such feature at its core, as it does not come with predefined window control system… or rether it does not enforce that on you. But there is 2 features in engine that can fulfill this functionality but they may not satisfy you:

First one is editor implementation of message box… problem is this is editor only :stuck_out_tongue: But if you do any editor extension it is worth to know it and you should use this in that case, it is global functions, there also non blocking version:

2nd, UE4 have a wrapper to platform specific implementation of message box, only problem is those are once always block and some platforms may not support it (as they dont have it)

And as you said yourself, yes your own implementation is best way to go on game runtime. And you don’t need to block the thread, as you can always use delegates (in fact first editor message box implementation use those too):

Since FMessageDialog sits in Core module, you can also reuse enums declered in there EAppMsgType and EAppReturnType

If you want to create blueprints support for it, it little bit more tricky as blueprints does not really support delegate over pins… with exception of FTimerDelegate which you can reuse, but you can only binds functions without arguments to it. You can also use laten function:

wit enum exec pin output:

3 Likes