Download

UMG Documentation for 4.4 Preview

what I’m trying to do is get a function to execute whenever the button is pressed, so I bound it to that event, but it doesn’t seem to be working. The function is not called when the button is pressed. Can you please give me an example?

Hmm, I didn’t do anything special really. I took a blueprint with a cube in it and called spawn actor on the viewport widget. Spawned the object at 0,0,0, and the moved the camera back like 200 units.

I’ve been building the scene “by hand” (spawn actor, set mesh, create light, etc). Is creating a blueprint as the scene the way you intended for it to be used?

That was one idea I had. The other was…it is a UWorld, sort of like an island universe, so in theory you could load a level also, but that’s totally untested. I could see the horror in the eyes of the Framework team when I told them my plans.

I’m just striking out over and over with this viewport widget. It is only painting the canvas with the background color no matter what I spawn. I’ll watch your changes on git and I look forward to your progress. Demo looked good today, keep it up!

@NickDarnell just wanted to say the Twitch stream today was very helpfull. I was trying to do things completely *** backwards based on my Unity experiences and after watching the stream today the way that UMG is supposed to work clicked.

Cannot wait to get into the latest git again now that I know how UMG is intended to be used and get something actually functional =)

I think next week will be more UMG as well which is going to be fantastic I love these weekly streams and this is the type of engine feature that I actually enjoy (I know it’s weird lol).

Don’t know if this has been answered yet, but is the old slate framework going to eventually be phased out, or is UMG built on top of the code that already exists?

UMG is on top of Slate (as the Editor is too btw…)

Nick,

Can you change aspect ratio during game time? is it possible? I mean the canvas panel aspect ratio. I want it to change while I change my screen size

Edit: I also found that my UE4 crashes whenever I try to set percent of progressbar. It only works if I bind the percent to a float and change that float.

The canvas panel (like almost all widgets) will conform to the size they’re told to conform to by their parent. So if your canvas fills the screen it will change however the screen changes. There are plans for DPI scaling rules, but I haven’t implemented that yet.

I see. I just watched the twitch video and it cleared a lot of confusion. I’ll post it here, so people can see it. http://www.twitch.tv/unrealengine/b/555570382 . I didn’t realize how powerful this is until I watched the video. Hehe thanks Nick!

Yeah, I was hoping the twitch tutorial would help people out. Good to know it did :slight_smile:

Thanks - turns out there is a bug there.

If you were to create a selection box for an RTS. Would you do it with UMG? and then translate the selection into a multi line trace? Or would you just spawn a rectangle on the floor and select all units within the rectangle? I remember seeing people do it with the HUD canvas and some with C++. I don’t know how to draw a dynamic box with UMG.

You can override on paint in a widget blueprint to draw simple stuff, but it’s not good enough for what you need yet I don’t think. If it were me, I’d extrude a frustum based on the selection rectangle and the camera parameters to get everything in or partially in the box, I dunno if that’s possible in blueprints, probably but you probably gota do the math manually.

The widgets themselves can act as drawing primitives though, there’s nothing stopping you from creating a userwidget that’s just a border with a marching ants border brush, and then dynamically add, and remove and change the slot parameters of said box on a canvas.

I have been trying to do something simple, replicate a keypad, in UMG and having issues so trying to figure out if I am doing it poorly or just a bug/unimplemented feature.

I spent some time trying to get the layout features working and eventually got the magic system under control. The fact that I can resize an Image by dragging on its handles only sometimes based on its parent caused me no end of problems.

Now I am trying to bind a new event to button click that will let me do something based on the button that was clicked. First I need to get the number that was in the label for that button. I could either traverse the hierarchy and get the label then its text value (if possible, no clue how since I can’t seem to figure out how to get the item that called the event) or I could get a parameter passed along with the button click to the event. I tried adding an IN Parameter to the Button Click event that I created but once I did that the Event was no longer usable on the Button as a valid Clicked On event (was not able to select it in the drop down).

Bugs or am I just doing this horribly wrong? Also as a small question with the way UMG is designed would something like a number input panel, for a pass code on a door, be all 1 Widget or should I be structuring it differently?

Mathew watch this http://www.twitch.tv/unrealengine/b/555570382 it’s somewhat like an unreleased tutorial.

@Valkon Thank you for the link I have watched it but unfortunately it does not seem to have what I need.

The video dynamically added in buttons as their own widget and then set the text on the buttons dynamically when created as well as stored a variable on the button itself which was referenced later. I wanted to do this all in editor and reference the Button Widgets which are in the my main BP Widget somehow. When the example video clicks on the button it can get the variable that was set when the widget was created for the button. When my button is clicked I can’t seem to get info about that button itself (which they did not either they just pulled in a variable that was set on the button). Alternately if I could pass in a parameter when it was clicked that would work as well (but that does not seem to work either).

Any ideas?

For reference my layout looks something like

Canvas

  • Vertical Box
    ++ Horizontal Box
    +++ Button
    ++++ Text
    +++ Button
    ++++ Text
    +++ Button
    ++++ Text
    … And then repeats the Horizontal box so its 4 rows.

I have an event on the Button when I click but how do I get at the Text in the Text below it or How do i pass in something to the Event when I click the button that I can set in the details panel or somewhere else?

@MathewW The functions don’t accept additional arguments for bindings, they have to match the same signature that I used when I generated them. The system doesn’t support additional arguments yet, maybe some day in the far future, but not right now.

@NickDarnell Understood.

I figured what I was doing different than expected and got it working once I figured out I could make Widgets for buttons that have parameters I can set and then use those Widgets in another Blueprint as a custom button basically so that part is all good now =)

OMG that sentence was horrible. I’ve got a working keypad with input now. It didn’t help that it looks like the main branch that is on the git removed some event binding sugar from the details panel… lol =)

Edit: I am still running into the issue where If I Add to Viewport with Modal and Mouse and then Remove from Viewport later I do not have mouse control back in the Viewport as expected before I displayed my widget

Super happy with the outcome so far once I got a handle on it. I am not happy with how I had to keep a reference to my BP Widget once I created it and access it later but I am just hoping I was doing something wrong. If anyone has any ideas on a better way of doing this let me know?

I have a generic Blueprint Actor that I have in the scene that simply creates the Widget, saves a reference to it in a public variable, and adds it to the viewport. If I want to pull it up in another BP graph for example I have to get all actors of that class, pull the first out of the array, cast it to my BP, then target the widget variable and then do what I want with it (run an event off it for example). This seems a bit much for something like this but I could be wrong.