- Home /
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?
And this is happening when I build for WebGL. In the WebGL build, it glitches the very first time I load the scene. I put an if statement in ```if(playerTransform.position.y < -10) { playerTransform.position = new Vector3(0, 10, 0); }```
and this if statement is being evaluated to true, but the correction I put in there is doing nothing.
Answer by ExtendedEuclideanEnforcer · Aug 20, 2021 at 05:14 PM
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.
Answer by joan_stark · Aug 24, 2021 at 07:28 PM
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.
Your answer
![](https://koobas.hobune.stream/wayback/20220613041856im_/https://answers.unity.com/themes/thub/images/avi.jpg)