Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Code snip to Get all scene in unity
- public void UnlockNextLevel()
- {
- int sceneCount = SceneManager.sceneCountInBuildSettings;
- string[] scenes = new string[sceneCount];
- for (int i = 0; i < sceneCount; i++)
- {
- scenes[i] = System.IO.Path.GetFileNameWithoutExtension(SceneUtility.GetScenePathByBuildIndex(i));
- }
- var nextSceneIndex = SceneManager.GetActiveScene().buildIndex + 1;
- if (nextSceneIndex <= sceneCount - 1 && scenes[nextSceneIndex].StartsWith("Level", StringComparison.Ordinal))
- {
- PlayerPrefs.SetString(scenes[nextSceneIndex], "unlocked");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement