Quantcast
Channel: Questions in topic: "playerprefs"
Viewing all articles
Browse latest Browse all 1333

How to make that if level 1 isnt finished, that you cant play level 2

$
0
0
If you reach the finish of level 1, the playerpref: Level1Done will be set to 1. So that number must be constantly updated. If you press the button of level 2, but you havent reached the finish of level 1. Unity won't load scene level 2. using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class GoToLevel2 : MonoBehaviour { void Update() { int Kaas = PlayerPrefs.GetInt("Level1Done"); } public void GoToLevelTwo() { if (Kaas == 1); { SceneManager.LoadScene("Level 2"); print("hudhunluhdc"); } } }

Viewing all articles
Browse latest Browse all 1333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>