I’ve been using UE4 for a few months now, and I’ve been using UMG since it got out of experimental. I’ve read the documentation, watched a few of the tutorial videos… I’ve gotten pretty comfortable with how I’m using UMG. I’ve been able to help a few people in IRC with some of the basic questions. The menu in my current project is fairly extensive and works really great, other than a few minor issues and it looking terrible (I’m no artist).
But I just spent about a half hour in the IRC channel talking to a few people including one I know for sure is an epic employee and is very knowledgeable about UMG. What did I get from the conversation? The fact that most of what I’m doing is wrong.
It started with me asking about how to prevent my mouse from interacting with world objects behind my menu. The conversation went into the layering order of widgets, adding as child instead of adding to viewport, parenting, z-order, etc etc… I was left feeling very confused and frustrated. So I’m going to try and describe what I’m doing right now, and then we can dissect/discuss whats wrong, whats right, and maybe come up with a better way of doing things.
I’m using the Top Down blueprint template as a base, and havent changed any of the default settings for mouse input. In creating my top down RPG, I have these Widget Blueprints:
A main menu bar - Displays health of character, and buttons to display the character and inventory sheets, as well as bring up the main menu.
A character menu - For displaying character attributes and stats
Inventory Menu - Allows me to interact with my inventory, and equipped items. Lots of buttons and logic.
Currently I am creating and drawing my menu and inventory like this in my HUD: http://i.imgur.com/SKIfwMB.jpg
Each widget blueprint has a canvas panel and then border for positioning and defining the menu area. The heirarchy looks like this: http://i.imgur.com/2Ha1Wix.jpg
Is this wrong? Is there a better way? What should I be doing different?
And now for populating the data on these menus. The information I need is stored on my character blueprint. When the Widget Blueprint is created, I’m making a reference to my character blueprint, and storing it as a variable cast as my character BP type, ( as opposed to just storing it as variable type Character), which allows me easier access to the native variables and functions created in my MyCharacter blueprint. For most of my current data, I only update and pull variable data OnConstruct, or when I click a button. Except for my character bar, which pulls player health on Event tick, which will end up changing frequently, especially in battle. In IRC, the epic employee mentioned something about multicast delegates, I think. It was a lot of big words that I didnt understand, the person realized that and it wasnt mentioned again
So what is the best way to get variables from a seperate blueprint onto the widget? The latest update (4.7) included something about binding to properties, but when I looked there I didnt see the data that was useful to me.
With my game, it is a top down RPG, WASD to move around, and using the mouse to interact with doors, levers, picking up items, etc. And when I bring up the inventory, interact with that menu, and be able to close it. I’m pretty sure this is a standard thing for this genre. In the future I also plan on making a spell toolbar, which will be clicked on, but also be controlled by hotkeys.