x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

HP/Mana Bar with UMG & C++

Hey,

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?

Product Version: UE 4.7
Tags:
more ▼

asked May 19 '15 at 08:54 AM in C++ Programming

avatar image

Sleicreider
160 34 33 46

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

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.

more ▼

answered May 19 '15 at 11:23 AM

avatar image

Andrii Melnyk
1.8k 60 19 112

avatar image Sleicreider May 19 '15 at 11:24 AM

ok thank you for the answer :)

avatar image Andrii Melnyk May 19 '15 at 12:22 PM

You are welcome! Good luck!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hello, Sleicreider

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!

more ▼

answered May 19 '15 at 09:59 AM

avatar image

Andrii Melnyk
1.8k 60 19 112

avatar image Sleicreider May 19 '15 at 10:08 AM

I already know the second link, with canvas and code its easy to create such a bar, but isn't UMG better or more preferred for such things?

avatar image kitblackheart May 19 '15 at 02:36 PM

UMG is just a more friendly way to implement SLATE Sleicreider, its like using umg but with code, umg was made for designers to be able to make UIs without having to know or use code.

*However Slate has more possibilities in creation, since it uses code and so you can pretty much do whatever you wish, while umg is more limited.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered May 19 '15 at 10:57 AM

avatar image

Andrii Melnyk
1.8k 60 19 112

avatar image Sleicreider May 19 '15 at 11:05 AM

and what about using canvas?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question