Unity has a physics bug where when changing the physics calculation method from FixedUpdate to Update, if there is a hidden child Rigidbody inside a parent Rigidbody and the parent Rigidbody rotates and moves, copying the hidden child Rigidbody, assigning the hidden child Rigidbody’s world position to the newly copied Rigidbody, setting the parent property of the newly copied Rigidbody to null and making it visible, the positions of the old and new Rigidbody do not match. What could be the problem?
I found the problem: it was with the Update physics engine. When I copied the Rigidbody, I retrieved it from the object pool, taking it directly if it was available, and assigned it a new position. After making it visible, the Rigidbody would continue its previous hidden physical movement, leading to the issue. So, I reset the Rigidbody’s movement in the OnEnable() method with rb.velocity = Vector3.zero, and that fixed the problem. What’s strange is that the FixedUpdate physics engine doesn’t require resetting the velocity in OnEnable(), while the Update physics engine does need the velocity to be reset in OnEnable().