Very helpful post, thanks!
- it would be nice to have a option to change Style of a button (and changing textures) using blueprints. I don’t know if I understand everything now but if I want to create couple of buttons I need to make couple of widgets. I would like to create one widget with button and change it’s style / textures on the fly.
if someone want to change offset and get button click event 's blueprint:
Maybe a bug: I’ve created new button style - when assigning it to the button it won’t change it still have default style in slate. Anyone had successfully created new button style?
No problems .
1.) Created a UMG Widget and put a button in it.
2.) Created a Slate Widget Style using Button as the template
3.) Assigned some textures and settings to the Normal, Pressed, etc… in the Slate Widget Style I created in step 2
4.) Assigned that Slate Widget Style to the button I created in step 1.
Did on the 4.4.0 from the launcher.
Weird - for me it isn’t working and did the same as you. Used compiled 4.4 from github.
And I’ve another thing:
- Create a widget with a button name it X,
- Spawn couple of X and change their positions so you will have 3 X buttons on the screen,
- Click events will work only for one button.
Anyone know how to fix that?
I have a question. When I try to get the variable “Is Checked” from the check box in the userwidget Event Graph, the compiler says “Function Is Checked is protected and can be called only from its class or subclasses”. Where should I pull that value from? If I cant pull that value the checkbox seems pretty useless at the moment. Also a suggestion for future UMG features, it would be cool if the slider could be snapped to user-defined values, and it would be fairly easy to get those values. Other wise, I think it’s great, I can’t wait for more documentation!
Make sure each of the buttons has their pressed events bound to the same function?
Bug, fixed in ML. Re: Slider, you want like user definable tick areas? You should be able to call GetPercent, or GetValue can’t remember what I called it.
ML? Does it work in 4.4, with a false error or do I need to do something to make it work? And I believe so, something like , where the slider snaps to each value, limiting your choices.
ML = MainLine / . Should work in 4.4, you’ll just get the warning (i think)
I wonder how you went about implementing the in/out transition.
The scoreboard popping in? That is using the UMG animation tool. It’s very easy to use, but very scary as well since it’s very work-in-progress ( You can try it out by keyframing any value that has a tiny keyframe icon next to it )
You can also try using a timeline like in the screenshots below to animate since your basically just moving 1 of the variables so its easy enough. Can also easily add in curves way as well.
My Scoreboard is just a UMG Widget that is a Canvas with a Border as a child. The initial settings for it layout wise don’t really matter since you will be adjusting them in the Make Margin part of the Move Leaderboard Function. The key was when you want to move “Border” item your basically adjusting the Canvas Margin settings that the Border sits inside of and getting access to that was done weirdly (see the screenshot)
The Timeline is just a 0.6s long linear curve that goes from -300 to +100. The width of the widget is 300 so puts it off the screen at the start and then moves it over 0.6 seconds 100 units into the screen when it is done.
All of event graph is in the Level Blueprint just to make it easy to capture the Tab key which I use to open/close the scoreboard
NO idea if is the right way to do it but it works as you can see.
One quick question… Does UMG Have any widget / option the draws an image and extends the widget to fit the image resolution / size?, Each time i use an image for my widgets i have to manually resize the widget until it looks like the image isnt streteched anymore…
How do i modify the padding on , for example, a boarder during runtime?
So far i have tried everything, casting from UserWidget -> My Widget class-> Get myBoarder variable -> from i can for example set Visibillity and such but i cant access layout.
Any suggestions?
Sizing in UMG is controlled by the parent widget. So if you place an image in the canvas, the canvas doesn’t allow the child to choose the size it wants it be, it sets the size to whatever you choose. If you’d like the behavior of the image getting to choose, you’ll need to use a flow layout panel such as the Vertical / Horizontal Box.
Everything you see under “Layout” are properties of the Slot. So if you’re looking at layout properties on border, you can ask for it’s slot, cast it to the correct slot type and then set the padding that way.
So if I have a structure like :
Border -> TextBlock
And I want to increase the padding between Border and TextBlock, I would get the TextBlock.Slot, cast Slot to a BorderSlot, and then set the padding on it.
I have tried that but i got casting failed when i tried to cast my “myBorder” variable to a BorderSlot.
Edit: I used my mySlotVariable -> Get slot -> Cast To BorderSlot , but when i use Get slot i get the main canvas slot and not my panel slot
Right that’s what I’m saying, if you want to control the slot, the slot is accessible from the content contained in it. So if you’ve got some content in a border, and you want to increase the padding between the border and its child, you need to access the child of the border, and get their slot.
Hmm still dont get it, if my hierarchy look like :
[CanvasPanel]
-Button1
-[MyBorder]
– [VerticalBox]
— Buttons
-Button
I want to access MyBorder layout so i can move MyBorder within the CanvasPanel
How would i do it the right way?
Update: sry my bad, i read it through more carefully now , ofc i should use MyBorder and then cast it to CanvasPanelSlot and then i can access the correct layout for myBorder