Progress Bar UI - why doesn't it work?
I have a 2 players local 2D game where they collect apples and they get 10 points per. I have a widget that is called when 100 total points are reached - an Endgame widget. That one part works.
The problem: I wanted to display each player's points using a progress bar. This is the function (for players' 1 points): This would otherwise work if I had converted it to text, for example (minus the int/int).
And then I have the progress bars, the % is bound to the function obviously (players' 1 points bound to the first progress bar, players' 2 points bound to the second)
Yet when the widget appears, the progress bars stay empty - although both players have individual points equal to a multiple of 10. I've tried this before and it didn't work that one time either so I just gave up and the in-game UI is just text - pretty unappealing right?
Where'd I go wrong? Thank you!
The progress bar goes from 0 to 1, from 0% to 100%. If you are dividing your points by 1 you are getting as a result your points, making the division redundant and getting always a number >1.
You should divide 1 by your total so you get the value of each item.
If you need 10 items, then divide 1/10 so each item has a value of .1 And multiply this by your picked items so your bar fills.
A lot of the time when I have the same issue, I add a node in the binding blueprint because usually when there is no nodes between Get Percent 0 and Return Node, it doesn't work. So try adding like instead of getting a ref, casting to the ref or casting to ThirdPersonCharacter and then getting "Game Ctrl BP".
Hope that helps.
Follow this question
Once you sign in you will be able to subscribe for any updates here