The second time I load a scene, the player falls through the ground

I have two scenes, a main menu scene and the game scene. I start in the main menu, click play, and the game scene works. The game ends, and it goes back to the main menu. When I click play again, when it goes into the game scene, the player is immediately falling through the ground. In the inspector, it shows that the player’s transform.position.y is going negative, but the script which references that transform prints that the player is still above ground.

Why is the player transform not correctly linked to the script the 2nd time the scene is loaded?

I don’t know why the player keeps being put underneath the ground, but I figured out that directly setting transform.position.y doesn’t work because of the CharacterController. I instead have to call CharacterController.Move(). And Move() still yields to collisions, so I have to first move the player past the edge of the world, move the player up past the top of the world border, then back over to where the player was, then down to ground level.

Unity physics sometimes goes crazy after loading scenes the first frames. Maybe it’s because of that. Maybe you can try disabling Character controller for the first frames.