Hello. I have a big question. I am making a 3D Racing game using the unity3d engine. The game works link this: You start at level 1 with one car. You have 2 Minutes to drive around the race track. If you made it you reach level2 and unlock a new car. But there is a problem. Your mother calls you to go eating and you close the game. After eating you come back and open the game and you want to play your level 2…
HOW CAN I MAKE IT THAT WHEN YOU CLOSE THE GAME IN LEVEL 2 AND OPEN IT AGAIN THAT YOU MUST NOT BEGIN AGAIN AT LEVEL1 ??? How can I load/save the lastest level you have reached??? Some scripts will be helpful:=)
You can use PlayerPrefs. Whenever you reach a new level, use the Set() method to update the last level reached, in a similar way:
//Here, you are in the function that updates the last level reached
//...
level_index++; //Because you've reached the next level
PlayerPrefs.SetInt("Last_Level", level_index);
And, at the beginning of the game, use Get() method to load last level reached: