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

PlayerPrefs not save my unlock button (Levels lock/unlock)

$
0
0
Hello, I have a problem adding buttons to prefab. I have several levels that are currently locked. The level buttons are locked with another button that on click open PopUp. In a PopUp is another button where on click unlock selected level (or sets the button to inactive). The problem is that Prefab doesn't save my button as inactive and every time I open it the "Locked Button" is active. Who can help me? Thanks everyone! My code: public class UnlockLevel : MonoBehaviour { public List unlocked; public List LevelButton; int i; public void Unlock(int level) { LevelButton[i++].gameObject.SetActive(false); PlayerPrefs.GetInt("Levels",i); } public void EnterLevel(int level) { if (unlocked[level] == true) { PlayerPrefs.SetInt("Levels", i); } } }

Viewing all articles
Browse latest Browse all 1333

Trending Articles



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