How to change Progress Bar size?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jarlowrey

I would like to set a progress bar to the size of a sprite’s width. I had this working in 2.1, but don’t see how to do it in 3.0. Any ideas?

func _resize_my_bar():
	var sprite = _my_entity.get_node("RigidBody2D/CollisionPolygon2D/Sprite")
	var parent_size = sprite.get_item_rect().size
	#x and y are reversed on the bodies, so reverse them here too
	var size = Vector2(max(parent_size.y,50), bar_height)
	var pos = Vector2(-size.x/2, -parent_size.x/2 - bar_height - bar_margin)
	_my_bar.edit_set_rect(Rect2(pos,size))

I know how to get sprite size: $KinematicBody2D/Sprite.texture.get_size(), but not how to change Progress Bar size

:bust_in_silhouette: Reply From: jarlowrey

It looks like it’s _bar.rect_size = size