- Home /
Application.LoadLevel(Application.loadedLevel); wont work While checkpoints are on
Hi guys, I've been working on a 3d platform game for about a month know and one of the problems that has frustrated me the most is that that Application.LoadLevel(Application.loadedLevel); works when my checkpoints are off. But when they are on it tends to work only when it feels like it not every time the player dies. Some advice would be great thank you.
To be able to help we would need to know how your checkpoint objects work. What do they do? Are they just triggers that store somewhere that they have been reached, and when reloading the player is placed there? Please also post some code.
Answer by TauseefCVS · Feb 12, 2018 at 08:38 AM
you add the scenes in build setting then its working. without adding scene it's not working.
Answer by upasnavig90 · Feb 12, 2018 at 11:39 AM
You can try SceneManager.LoadScene , https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.LoadScene.html
may be checkpoints are not the problem, check for something else, can you share your code snippet?
public void TakeDamage(int damage) { health -= damage; if (health <= 0) //< { Destroy(gameObject); Application.LoadLevel(Application.loadedLevel); } }
Answer by Caldera12 · Feb 12, 2018 at 12:26 PM
It works totally fine without checkpoints, but when checkpoints are on , it only works when it wants to. Such as i die 3 times it wont work but then the next time i die it works.Or vice versa it works 5 times in a row and the next time i die it doesn't work. I'm not calling it in update.