Why is player unable to move after transform.position?
In the game, the player is on a plateau type environment and whenever they fall and pass below a certain point (y = 90) the player is transported to the last checkpoint they activated (or starting point if none have been). However, after being transported to this checkpoint, the player is unable to move but is able to look around. Here is the code I am using for the checkpoint and player controller.
```
public class Checkpoint : MonoBehaviour
{
void OnTriggerEnter(Collider collider)
{
if (collider.tag == "Player")
{
Debug.Log("Checkpoint updated.");
GameVariables.checkpoint = transform.position;
}
}
}
```
```
public class FallDetect : MonoBehaviour
{
void Awake()
{
GameVariables.checkpoint = transform.position;
}
void Update()
{
if (transform.position.y < 90)
{
transform.position = GameVariables.checkpoint;
}
}
}
```
Answer by tormentoarmagedoom · May 10, 2019 at 12:10 AM
Hello.
Are you sure GameVariables.checkpoint position is not y<90 ? If is still true, Update() is changing its position each frame, so you restart allframes from GameVariables.checkpoint position.
If the probem is not that, then another script is interacting, or lines you doidnt post
Bye!
Your answer
![](https://koobas.hobune.stream/wayback/20220612201007im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Character Gets Stuck On 2D Tile Floor 0 Answers
A motionless object having multiple positions at the same time 1 Answer
fpscontroller doesnt respawn (maybe transform.position issue?) 0 Answers
Rigidbody / Animator Moving Y Position - bug? 1 Answer
Jittering transform.position values when GameObject is not moving. 1 Answer