Godot Version
v4.6.1.stable.official [14d19694e]
Question
I’m trying to add ladders to my game. To speed up the level editing process, I wrote this function:
func _update_area_size() -> void:
$Area2D/CollisionShape2D.shape.size = size
$Area2D.position = Vector2(size.x / 2, size.y / 2)
$VisibleOnScreenEnabler2D.rect = Rect2(-size.x / 2, 16, size.x, size.y)
However, now, if I have multiple instances of the ladder scene in a level, they all update the area size to whatever it was in the last one of them. How do I fix this?