# Set HUD component width to variable

**URL:** <https://forums.unrealengine.com/t/set-hud-component-width-to-variable/718294>\
**Category:** Rendering\
**Tags:** hud-blueprint, unreal-engine, UI, Widget, question, UMG\
**Created:** [November 30, 2022, 4:20am UTC](https://forums.unrealengine.com/t/set-hud-component-width-to-variable/718294 "2022-11-30T04:20:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dkol](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dkol](https://forums.unrealengine.com/u/Dkol)\
**Post date:** [November 30, 2022, 4:20am UTC](https://forums.unrealengine.com/t/set-hud-component-width-to-variable/718294/1 "2022-11-30T04:20:09Z")

</div>

Hi, I have a xp bar that should go from one side of the screen to the other. But when I change the window resolution it stays the same size and only have the same placement.

 ![designer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/0/8/a08104fc35bc84d3918d84d5b6831f130a4441b1.png)

 ![windowed](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/1/6/f1617d1554ae59f84460f490ebe41d70959fc65d.jpeg)

 ![editor fullscreen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/8/4/184fdd8bb67da1c77a8380c02b462f5887121ba1.jpeg)

Is it possible to get the window width/resolution and use it on the width parameter of the xp bar?

---

<div class="post-metadata">

**Author:** ![Mind-Brain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mind-brain/32/906573_2.png) [@Mind-Brain](https://forums.unrealengine.com/u/Mind-Brain)\
**Post date:** [November 30, 2022, 4:47am UTC](https://forums.unrealengine.com/t/set-hud-component-width-to-variable/718294/2 "2022-11-30T04:47:14Z")

</div>

Hey @Dkol!

I’m not sure how to do exactly what you’re wanting here, but I THINK this set of nodes here could be put to use! You can grab the X from “Get Viewport Size”, divided by 2 is the halfway point, with 0 and the whole value as either end! 🙂

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/b/c/3bc33f81fa629aa91fee309335323631e197c000.png)

---

<div class="post-metadata">

**Author:** ![Dkol](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dkol](https://forums.unrealengine.com/u/Dkol)\
**Post date:** [November 30, 2022, 11:15pm UTC](https://forums.unrealengine.com/t/set-hud-component-width-to-variable/718294/3 "2022-11-30T23:15:22Z")

</div>

Hi @Mind-Brain!

I don’t know if it’s supposed to but when I used the nodes you sent, it returned 0 for both X and Y but I managed to get the resolution using these nodes:

![nodes to get width](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/a/7/2a7535c144fe8787764d0bfd9c9b303737966c15.png)

But what I want is to know if I could bind the progress bar width to a function the same way you can bind other components like the Percent of the bar or use another method to set it to my Window Width variable when the player starts the game.

 ![components](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/0/5/105343d9299bca856c3f65a419562052db9b5ced.png)
