Get size of parent collisionShape

Godot Version

v4.2.1.stable.mono.official [b09f793f5]

Question

I have an “obstacle” scene, which is an area3D, and I want it to automatically change its collisionShape size to the CollisionShape of the obstacle’s parent.

This is my script:

public override void _Ready()
  {
    collisionShape = GetNode<CollisionShape3D>("CollisionShape3D");
    BodyEntered += OnBodyEntered;
    
    var parentShape =  GetParent().GetNode<CollisionShape3D>("CollisionShape3D");
    if (IsInstanceValid(parentShape)) size = ((BoxShape3D)parentShape.Shape).Size * 1.01f;
    GD.Print(size);
    ChangeSize(size);
  }

public void ChangeSize(Vector3 s)
  {
    var shape = (BoxShape3D)GetNode<CollisionShape3D>("CollisionShape3D").Shape;
    shape.Size = s;
  }

I have a block scene with this hierarchy:
Immagine 2024-04-27 094225

If I run this scene, the size changing seems to work correctly.
But if I instance the block scene in some other scene, like this:
Immagine 2024-04-27 094248
Then the size of the parentShape seems to always be one, even if it actually has a different size.

What could be the problem?