Why do all of my instances update simultaneously when I don't want them to?

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?

Shapes are Resources and they can be shared between instances. If you don’t want that, right click on a shape and select Make Unique.

Thanks. Any way to do it through code? I suspect it would get pretty tiresome to do so for every ladder instance.

Yes, you can Resource::duplicate()

3 Likes