Resize object in runtime

I have 4 rigid bodies connected with hinge joints. They are children to an empty parent object.

When I scale the parent at run-time using localScale the relative positions of the child objects get change.

But if I scale it in editor it works out fine.

Can anyone explain why this is happening ?

9731-object.png

I assume you do the resizing at runtime (the code above) only once in the Awake or Start method, right?

Your problems might have to do with the Rigidbodies you are using. They are part of the Physics engine Unity is offering. You should manipulate them preferably only in a FixedUpdate() method of MonoBehaviour (or as I said in the Awake or Start method before the Update calls are running). Try to set the Rigidbodies to isKinematic = true before resizing and afterwards switch the isKinematic off again and see whether this avoids the problem.