Hello,
I made a widget for the health of characters. One is displayed on the top of the screen for the player and works fine. This one is created on the event begin to play and added to the viewport.
Another one is attached to an enemy in the corresponding blueprint. I managed to change the percent value of the scrollbar but nothing changes on the screen, the scrollbar never updates the graphics.
Here is my code to update the percent value, all the values are float:
Finally, it works but only in screen mode for the widget and Update Life event in the widget…
So now the problem is the size and position of this scrollbar…
I google that.
Thank you a lot for your help !!!
Hi and thank you for your answer.
When the projectile hit something, it tests if the collided object implements a function named ‘Cause damage’. The amount of damage is passed through this function and then Update Life is called.
‘Cause damage’ is just the implementation of an interface.
I haven’t read your link ,I come back when I finish reading.
well, I made different tests after reading your link.
Change to screen mode does not solve the problem.
Referencing widget in the Begin play event too.
And yes, I can print to screen the health from the scrollbar component and it works fine.
I mean when my enemy receives a projectile hit, I can see the value decreases correctly, and this value came from the scrollbar component.
I’ll try to download the project of your link and come back after.
So the only main difference between the project of your link and mine is that Update life is implemented in my enemy blueprint, not in the widget.
I moved this function to my widget, and I have the same result: print string in the widget displays a correct score but the scrollbar does not change on the screen…
This is really strange…