Question by
Louis-LCM · Nov 22, 2015 at 04:03 PM ·
androidplayerprefssavingsave dataplayersettings
PlayerPrefs help !
Hi,
I tried in very much ways, but I really can't figure it out. This is a level lock/unlock system made by me. On my PC works perfectlly, but when I test it on my android smartphone nothing works. Why ? If I will use PlayerPrefs will work ? How I should use PlayerPrefs ? Because I tried in very much ways and no result.
Here is my script:
using UnityEngine;
using System.Collections;
public class LevelLockSystem : MonoBehaviour {
public GameObject unlockLevel2;
public GameObject unlockLevel3;
public GameObject unlockLevel4;
public GameObject unlockLevel5;
public GameObject unlockLevel6;
public GameObject unlockLevel7;
public GameObject unlockLevel8;
public GameObject unlockLevel9;
public GameObject unlockLevel10;
public void Start()
{
}
public void LockAllLevels()
{
unlockLevel2.SetActive(true);
unlockLevel3.SetActive(true);
unlockLevel4.SetActive(true);
unlockLevel5.SetActive(true);
unlockLevel6.SetActive(true);
unlockLevel7.SetActive(true);
unlockLevel8.SetActive(true);
unlockLevel9.SetActive(true);
unlockLevel10.SetActive(true);
}
public void UnlockLevel2()
{
unlockLevel2.SetActive(false);
}
public void UnlockLevel3()
{
unlockLevel3.SetActive(false);
}
public void UnlockLevel4()
{
unlockLevel4.SetActive(false);
}
public void UnlockLevel5()
{
unlockLevel5.SetActive(false);
}
public void UnlockLevel6()
{
unlockLevel6.SetActive(false);
}
public void UnlockLevel7()
{
unlockLevel7.SetActive(false);
}
public void UnlockLevel8()
{
unlockLevel8.SetActive(false);
}
public void UnlockLevel9()
{
unlockLevel9.SetActive(false);
}
public void UnlockLevel10()
{
unlockLevel10.SetActive(false);
}
}
Comment
Hi Louis, Where exactly are you calling PlayerPref on this script? Is there another script?
Your answer
Follow this Question
Related Questions
Saving In Between Scenes and Program Exit 0 Answers
Are playerprefs a safe way of saving data or not?? 2 Answers
How do I apply and save my game settings? 0 Answers
Problem saving with PlayerPrefs 0 Answers