Not sure how to maximize the size of a widget

I’m trying to build widget functionality like a website would act, how you minimize or maximize the size of your window or exit out.

Right now I’m trying to build functionality in a button that would maximize the size of the widget to fit the rest of the viewport in game. Maybe I’m missing some conceptual stuff but I don’t see a good way to do that.

Most people talk about scale/size box as a method, but that seems like its only for in editor not in game.

Hello,

I can think of two ways of doing it.

  1. With blueprint code.

Not quite, but I will admit it is a bit tricky at first.
You could start a timer that would increase the size of your Sizebox/Scalebox/anything else, but you would need to constantly do checks so you don’t expand into infinity and stop the timer.
It’s possible to call an event that would trigger a timer on a child widget too.
I tested both scenarios and it does work.

I’ve kinda rushed this so I didn’t think for better solution, just what works for now.

However I believe you’re better of with option below.

  1. Use animations inside widgets. It’s based on keyframes and you can control a ton of stuff, you will see what by the icon next to fields in details panel.

That way you could create an animation that would maximize and minimize whatever you want, however fast, and the beauty of it, animations come with Forward/Reverse nodes so all you need to do is create an animation, key things around and setup your play animation on button press.

I invite you to read Animating UMG Widgets documentation. It’s a really cool thing to know and use.

Perhaps this could get you to achieve desired effect.

2 Likes

That worked pretty well. I didn’t know you could do that with widgets. Thanks!

1 Like