UMG and C++

Can I get a code example of how I would work with data from C++ and display it using UMG.

For example, let’s just pick something really simple and say I give my player a basic health system in C++ and I want to display that in UMG. How would I go about doing that?

I don’t recommend directly working with UMG from C++ - (little to no doc, and that’s not the workflow we’re focused on right now). All of the animation tools, and layout tools are based around creating a widget blueprint. You don’t have to keep the logic in blueprint land, you can expose UFunctions and UProperties in C++ for the UI to interact with and display. But you should use the designer for making the health bar…etc.

You can write logic in C++ and then extend it visually in the designer by doing ,
https://forums.unrealengine.com/showthread.php?38097-Tutorial-Extend-UUserWidget-for-UMG

Cheers,
Nick

is great; thanks Nick!

@Nick Darnell
Sorry to bump , I was just wondering if the “working with UMG from C++…'s not the workflow we’re focused on right now” part still holds true.

No, that no longer holds true. But - I would still suggest designing the UI in the designer, and putting the logic in a C++ base class, if that’s where you’d rather have the logic.

What exactly does mean? What c++ /UMG aspects have changed or have become focused on?

Hi. Same thoughts. finding it a bit hard to follow. How should I split the work when working i.e with main menu. Create HUD, create Widget blueprint (and design it accordingly). How can I access Widget blueprint in code and send data to display?

I would be very thankful to get some hints, where to look maybe. I am rather confused right now as I can´t find much on the internet how c++/blueprint workflow works here.

Thanks for your help. I didn´t mean how C++ works with blueprints, but how it´s supposed to work when working iwth UI (Main menu for example). Mostly people use blueprints for both designing the main menu and for dataflow and don´t use C++ there…

I mean it´s exceptionally easy to work when creating AI (behaviortree logic in blueprints - easiser to debug) and the controller. character logic with c++.

Thanks alot for your help :slight_smile:

Might a Source Example of couple custom UMG Charts help you along?

How C++ works with BP is pretty good covered if you look around the Internet. You gotta up your Research Game :smiley: