UE4 How does UMG Scaling Work?
I am doing some of my HUD stuff with UMG widgets, but some of it inside the HUD blueprint using Draw Texture Simple functions and stuff. What I want is that when the viewport size changes, the things drawn by my HUD blueprint and the things drawn by my widget blueprint both scale in the same way, so they line up. I am aware that by default UMG uses the length of the smallest side and uses that to scale how big the things are that it draws, but how does it work with scaling the position of the things it draws?
I assumed here that what it does is gets the size of the shortest side of the viewport and divides it by 180 to create a multiplier. Then it could apply that multiplier to both the scale of the objects and the position of them. So, I created a HUD blueprint that worked the same way. But when I scale the viewport they don't line up, so my assumption must be incorrect. How does UMG scaling work and how can I simulate that in my HUD blueprint?
Thanks in advance!
asked Feb 10 '18 at 04:22 PM in Blueprint Scripting
Looks like I have answered my own question. I am posting a reply for anyone else wondering the same thing.
UMG widgets scale position based on position relative to the anchor. So, if you anchor something to the centre of the screen it will scale differently to if it was anchored to the top left of the screen. My problem was that my widgets were anchored to the centre, but the way my HUD code worked was effectively anchoring it to the top left. Therefore, they didn't line up. Hope this helps someone!
answered Feb 10 '18 at 05:15 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here