Lifes count resets with level
Hi, I was wondering if there is any way of resetting the level without having the lives count constantly resetting back to default amount. I've been trying to figure this out for some time but have kept struggling. Here's the screenshot of my script: http://prntscr.com/g27c66 http://prntscr.com/g27cdo It will be greatly appreciated if this can be resolved. FYI the game is a basic ball rolling game that resets the level once a collision is made with the barrier. Thanks, -Jin
The problem is that you are reloading the whole Scene as soon as the Player hits the Barrier:
Application.LoadLevel("ball game 2");
Ins$$anonymous$$d, you should try to make another function/method that just spawns the Player at the beginning of the level again (if that is what you are after).
From the code it seems more like you just want to reduce the "lives" value by 1. You could just have the game keep going and reduce the Players lives until it's 0 and then try calling
Application.LoadLevel("ball game 2");
to restart the whole game at that point.
Your answer
Follow this Question
Related Questions
Why is my scene not loading? 2 Answers
How to access a GameObject in another scene? 2 Answers
changing scene not working? 0 Answers
[Unity Beginner] Game design question on scene loading and scene transitioning 0 Answers
How do I use 3 scenes (menu and 2 maps) while only leaving the current scene and menu active? 0 Answers