HP/Mana Bar with UMG & C++
I want to create a simple mana & hp bar for my character. I know how to do it with HUD/Canvas, but I think UMG is better for UI things right?
My Problem now is, I have no idea how to use UMG. Beside the design oft the mana/hp bar i want to do everything in c++, (progress etc.).
Until now I've seen that there is something called a Widget Blueprint, where I can drag & drop a Progress bar and this has to be added to the Viewport, but how do i get this Widget Blueprint from C++ to add it to the viewport? I've tried using the ConstructorHelpers and get it by it's path, but somehow it doesn't work.
Can anyone help or has an better solution to create such an UI?
asked May 19 '15 at 08:54 AM in C++ Programming
Canvas is convenient for intermediate stages of development, when you need to implement some approximate test functionality. However, for a final version UMG is more appropriate.
answered May 19 '15 at 11:23 AM
You can create Health bar using Slate UI Framework in C++ (SCompoundWidget class in particular).
Slate is a custom and platform independent user interface framework that is designed for effective creation of user interfaces for games and custom tools. If you like to learn more about Slate, please go here: https://docs.unrealengine.com/latest/INT/Programming/Slate/Overview/index.html
For an example of health bar implementation, please go here: https://forums.unrealengine.com/showthread.php?15108-How-to-do-simple-Health-bar-using-Slate-in-C
In addition, if you like to learn more about buttons creation and drawing in HUD, please go here: https://wiki.unrealengine.com/HUD,_Canvas,_Code_Sample_of_800%2B_Lines,_Create_Buttons_%26_Draw_Materials
Hope this helped!
Have a great day!
UMG is easier to use and has the same functionality as Slate, but in some cases you may need to use Slate since it provides more possibilities for customization.
answered May 19 '15 at 10:57 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here