Content example blueprint HUD
HUD and Menu in Blueprint
The UE4 Marketplace (at least 4.1 upwards)include Content Example that includes "Blueprint_HUD". Specifically to find the Content Examples you need to look under the Learn tab and not the Marketplace tab In the Unreal Launcher.
This examples demonstrates a very simple BP implementation of a Menu which is invokved by pressing 'M'. It shows pausing on the game and displaying a menu, acting on click events and then resuming the game.
Unreal staff member Steve Allison stated this about the example in an AnswerHUB response ( https://answers.unrealengine.com/questions/16558/hud-create-a-basic-menu.html ):
- The high level outline would be that your map needs a GameMode blueprint (see here) which will allow you to specify blueprints that will likely control your HUD--PlayerController Class and HUD Class.
- Your PlayerController Class would ideally be where you want to handle any keyboard inputs for your map/game/HUD. For example, in Blueprint_HUD map, the BP_PlayerController_HUD blueprint is where we have our Input M to open the menu.
- Your HUD Class is where all the magic happens with drawing your HUD. Event Receive Draw HUD is a Tick event, meaning it will fire off every frame of your game to draw your HUD given the instructions you connect to it. In the Blueprint_HUD map, our BP_HUD_Example has a branch early on that is toggled based on if the Menu should be drawn or not. If not, the main gameplay HUD is drawn, if yes, the Menu HUD is drawn (and gameplay HUD is not).
- The HUD Class also contains the events for when you click the Hitboxes that are drawn by the Receive Draw HUD event.
- Hopefully this enough to keep you going on working with Blueprint HUD. We're working hard to get more official documentation for both Blueprint HUD and C++ HUD and hope to be able to provide it soon!
Relevant UE4 Video Tutorial: https://www.youtube.com/watch?v=7gwgU0UPENA&feature=youtu.be