- Home /
how to make a checkpoints on unity for one player
hi, i wanna ask about how to make a checkpoint at oneplayer ? thanks,
Answer by MT369MT · May 23, 2018 at 05:18 AM
Hi, First you need to check the collision between your player and your chechpoint and if it is true it set a static bool to true like: public static bool HaveCheckpoint; void OnTriggerEnter (collision Col) { if (Col.gameObject.tag == “checkpoint”) { HaveCheckpoint = true; } }
Then when you respawn you must say to your player to go to the checkpoint position. After the reloading scene script write: public Transform CheckpointPosition
//after reload scene if (HaveCheckpoint == true) { transform.position = CheckpointPosition.position; }
Assign your checkpoint Transform in the inspector. When you finish your level reset HaveCheckpoint to false.
Your answer

Follow this Question
Related Questions
checkpoint question???? 5 Answers
Checkpoint autosave Method? 0 Answers
How to Make a Checkpoint for a 3D game! 1 Answer
X and Y translation limits and checkpoints 1 Answer
Checkpoint automatic save/load 2 Answers