Resize Progress Bar on key down

Hey,

I’m trying to resize a Progress Bar while the game is running. I’m trying to access the widget from the player blueprint but I can’t get it to work.

The only thing that does something is when I use ‘Get All Widgets Of Class’ and then ‘Set Position in Viewport’ it moves the widget. ‘Set Desired Size In Viewport’ sadly does nothing, if I enter a value < than the X size of the widget it simply disappears and > than X isn’t doing anything.

Please keep it simply I’m not really experienced in UE4.

Are you trying to make the widget appear visually larger or lengthen it like a lifebar increasing in capacity or something to that effect?

For the former, you can simply change the render transform scale. For the latter we’ll need more info - what’s the widget’s parent? By default it would be a canvas panel, so assuming that to be the case, you’ll first have to get the widget’s slot, cast it to a canvas panel slot, then set the desired size from there.

I’m trying to do the latter, increasing the size of a life bar.
As I’m creating the widget I cast it to a variable so that I can add it to the Viewport. The parent of the widget is indeed the canvas panel.

Getting the widget slot and casting to canvas panel slot works, but when I’m trying to access the slot it returns null.
Error: Error Blueprint Runtime Error: Accessed None trying to read property K2Node_DynamicCast_AsCanvas_Panel_Slot from function: ‘ExecuteUbergraph_BP_Player’ from node: Set Size in graph: EventGraph in object: BP_Player with description: Accessed None trying to read property K2Node_DynamicCast_AsCanvas_Panel_Slot

I’m doing it like that:

https://docs.unrealengine.com/latest/images/Engine/UMG/UserGuide/CreatingWidgets/CreateWidgetNode.jpg

Same for me, its triggering when i cant resize the progress bar it triggers me so much that i literally slam my desk 893247894237894327897328974328974893274238974892374892374892378932478923789 times.

To increase the size of a progress bar dynamically for adding extra health, ammo, abilities/power etc you can follow this tutorial.