Hello, I wanted to add some HUD to my game, and faced with problem. I wanted to wrote the game on C++, but if I follow this tutorial, I should add GameMode blueprint, and now I have some question. Is it necessary to create blueprint to create HUD? If I add blueprint to game how badly it will be affect on perfomance?
P.S.: Sorry for my bad English, If you see some errata, please try to take a quieter.
BP aren’t really bad, it’s just Cpp functions, in fact if a function do too many things, you can create your own cpp function and make them BP available.
No it not, at most you will need a hybrid solution. There 2 things you can use in C++:
-AHUD, the classical HUD canvas system for UE3 that is still in UE4, it was made to be operable in UnrealScriipt so it’s easy to operate it in C++
Because it has no explicit name it quite hard to find tutorials for it, you could try looking on UE3 material as it works in similar way. Also i dont think you need to worry about deprication of this as UE4 still heavy uses this to print debug data, all “stat” and “show” commends use this to print stuff on screen.
-2nd is Slate, Slate is a UI framework made for UE4 editor UI (UE3 used primery Windows UI APIs for editor), but it can be used in gameplay too… in fact it framework that powers UMG, it was made because Slate code is 95% incompatible with UE4 refllection system and effectivly blueprints, so wrapper was needed to be made which UMG is. Here docs:
UMG is also C++ programmable (all you see in blueprints is C++ programble as all this sits in engine source code you can call up from C++), but Slate a lot more comfitible to use in C++, the huge plus is fact it uses some C++ hacks to make describing UI in code a hell lot easier:
Not to mention UMG don’t have all slate widgets binded to it, so sale has a lot bigger pallet of widget, you can explore them here:
Only thing you need to watch out is to not use editor widget sitting in editor modules, those won’t build in packaged game. Minus is as all editor related stuff, it is weakly documented, but once you catch the pace you should able to figure things out by yourself
Blueprint VM is around 10 slower, you can use blueprint nativisation to compile blueprint in to C++ during packaging which gives near native speeds. All C++ code that you call out in blueprint is executed in normal native speed ofcorse.