# Convert int to float progress bar problem

**URL:** <https://forums.unrealengine.com/t/convert-int-to-float-progress-bar-problem/445969>\
**Category:** UI\
**Tags:** unreal-engine, Widget, question, function-signature\
**Created:** [March 25, 2019, 6:51pm UTC](https://forums.unrealengine.com/t/convert-int-to-float-progress-bar-problem/445969 "2019-03-25T18:51:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_1341af35](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1341af35](https://forums.unrealengine.com/u/anonymous_user_1341af35)\
**Post date:** [March 25, 2019, 6:51pm UTC](https://forums.unrealengine.com/t/convert-int-to-float-progress-bar-problem/445969/1 "2019-03-25T18:51:35Z")

</div>

Hello,

I have a progress bar and this function bound to it:

 ![272335-int-to-float.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/b/7/eb75f33d92e1577890e56044fb79298089cfcba6.png)

I would like the bar to display the score, in percentages. I am dividing 1 / 500 (max score) and then \* current score. It would go like (1 / 500) x 10 = 0.02 or 2%, which should otherwise fill the bar by 2%. But it doesn’t. The progress bar never gets filled, no matter the score - and I wonder if the int to float conversion is the fault here.

The ‘SCORE’ is the total score or the sum of two player scores, nothing fancy. So P1 + P2 = SCORE.  
The widget is created and added to the viewport - tied to the BeginPlay event.  
Maybe it has to do with the actual score system, as in, maybe it doesn’t check the score at all? I am so confused.

Any help would be much appreciated!

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 25, 2019, 8:02pm UTC](https://forums.unrealengine.com/t/convert-int-to-float-progress-bar-problem/445969/2 "2019-03-25T20:02:48Z")

</div>

The math is fine.

Put .5 manually in the return value and see if you get a result.

If you do, the score is 0 or the GMR is invalid.

If you do not see a result, you’re looking at the wrong widget.

---

<div class="post-metadata">

**Author:** ![Nebula\_Games\_Inc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nebula\_Games\_Inc](https://forums.unrealengine.com/u/Nebula_Games_Inc)\
**Post date:** [March 25, 2019, 11:27pm UTC](https://forums.unrealengine.com/t/convert-int-to-float-progress-bar-problem/445969/3 "2019-03-25T23:27:35Z")

</div>

My bet, GMR is just an empty variable and isn’t actually “Set” anywhere thus making it a null reference. How did you create “GMR”? Did you ever use a “Set” node with it?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1341af35](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1341af35](https://forums.unrealengine.com/u/anonymous_user_1341af35)\
**Post date:** [March 26, 2019, 11:01am UTC](https://forums.unrealengine.com/t/convert-int-to-float-progress-bar-problem/445969/4 "2019-03-26T11:01:26Z")

</div>

GMR is a game mode reference variable. I don’t think I did actually.

EDIT: I’ve just ‘set’ it in the widget’s event graph by simply casting to game controller, getting game mode and setting the GameModeReference variable. The progress bar is now working fine. Thank you!

---

<div class="post-metadata">

**Author:** ![Nebula\_Games\_Inc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nebula\_Games\_Inc](https://forums.unrealengine.com/u/Nebula_Games_Inc)\
**Post date:** [March 26, 2019, 2:17pm UTC](https://forums.unrealengine.com/t/convert-int-to-float-progress-bar-problem/445969/5 "2019-03-26T14:17:02Z")

</div>

Glad we got it figured out 🙂
