While trying to make an interactive 2D widget with clickable buttons in Unreal Engine 5.0, I noticed some differences between it and the UE 4.27 version. The newer version seems a bit more complicated, as you have to create separate button widgets for a main one just to create buttons. While, in UE 4.27, you only need to click and drag buttons into an already made border. Or am I doing something wrong just by making the wrong kind of user widget?
When I start to make a new widget in UE 5.02 and then I click and drag one button, it takes up the entire space. After doing some reading, I found that it’s because one entire button can be one widget and a piece of a whole menu widget. Also, though I found instructions telling me to add an “OnClicked” event for each custom button, I see no such option. I don’t even see anything that will let me add that event for each button!
It’s because UE4 comes with a canvas panel by default while UE5 does not. Add a canvas panel first, then you’ll be able to distribute ui elements by dragging them around.
So I would click and drag border first? Because if I click and drag a button, it takes up the entire area. I read that a single button can be one widget and part of a larger one, but I’m still confused since I would likely have to add a button to a larger picture.
A canvas is special container that can have many children - other widgets, like buttons, borders, text blocks, user widgets.
The unique thing about canvas is the anchoring system. If you want to have a piece of UI attached to the bottom of the viewport, regardless of the resolution used, you’d use a canvas panel. You can also set the position and size of hoated widgets explicitly via the slots the canvas panel creates for them.
Make a new widget in the Content Browser, open it and add a canvas. From now on you can have additional elements added to the canvas and manipulate them as you see fit.
I just looked up a random tut and it seems the button is there, in the common tab, where it has always been. But things may look different on your side.
Can you show a screenshot of the palette where all the widgets sit?
What I want to do is make a puzzle that involves clicking on buttons that show numbers from 1 to 6 and a certain total must be met as the player makes a path from the start to the finish. So I wanted to put in an integer variable for each button, as well as a command to add the total by said number when each button is turned on and subtract when a button is turned off.
Now it makes sense. Basically, the only difference is that you have to add a canvas before putting anything else on it. After I clicked and dragged buttons onto the canvas, I saw each one has its own multiple “begin event” conditions.