i have been looking/watching videos and reading documentation today, but i am still unable to figure out if there is a limit on how many variables you can store under a playerprefs save. this is my code that im using.
public class Loading : MonoBehaviour {
public GameObject saveButton;
public static void LoadAllInformation()
{
GameControl.control.fish = PlayerPrefs.GetFloat ("TOTALFISH");
GameControl.control.fishPerClick = PlayerPrefs.GetFloat ("FISHPERCLICK");
GameControl.control.fishJewels = PlayerPrefs.GetFloat ("FISHJEWELS");
GameControl.control.currentExperience = PlayerPrefs.GetFloat ("CURRENTXP");
GameControl.control.fishingRank = PlayerPrefs.GetInt("FISHINGRANK");
GameControl.control.baseCost = PlayerPrefs.GetFloat ("BASECOST");
GameControl.control.cost = PlayerPrefs.GetInt("COST");
GameControl.control.clickPower = PlayerPrefs.GetFloat ("CLICKPOWER");
GameControl.control.count = PlayerPrefs.GetFloat ("COUNT");
GameControl.control.baseCostA = PlayerPrefs.GetFloat ("BASECOSTA");
GameControl.control.costA = PlayerPrefs.GetFloat ("COSTA");
GameControl.control.clickPowerA = PlayerPrefs.GetFloat("CLICKPOWERA");
GameControl.control.countA = PlayerPrefs.GetInt ("COUNTA");
GameControl.control.baseCostB = PlayerPrefs.GetFloat ("BASECOSTB");
GameControl.control.costB = PlayerPrefs.GetFloat ("COSTB");
GameControl.control.clickPowerB = PlayerPrefs.GetFloat("CLICKPOWERB");
GameControl.control.countB = PlayerPrefs.GetInt ("COUNTB");
GameControl.control.baseCostC = PlayerPrefs.GetFloat ("BASECOSTC");
GameControl.control.costC = PlayerPrefs.GetFloat ("COSTC");
GameControl.control.clickPowerC = PlayerPrefs.GetFloat("CLICKPOWERC");
GameControl.control.countC = PlayerPrefs.GetInt ("COUNTC");
}
public void OnClick()
{
LoadAllInformation ();
Debug.Log ("Information Loaded");
}
// Use this for initialization
void Start ()
{
// LoadAllInformation ();
}
// Update is called once per frame
void Update () {
}
}
for the load, and then this for the save.
using UnityEngine;
using System.Collections;
public class Save: MonoBehaviour {
public GameObject saveButton;
public static void SaveAllInformation()
{
PlayerPrefs.SetFloat ("TOTALFISH", GameControl.control.fish);
PlayerPrefs.SetFloat ("FISHPERCLICK", GameControl.control.fishPerClick);
PlayerPrefs.SetFloat ("FISHJEWELS", GameControl.control.fishJewels);
PlayerPrefs.SetFloat ("CURRENTXP", GameControl.control.currentExperience);
PlayerPrefs.SetInt ("FISHINGRANK", GameControl.control.fishingRank);
PlayerPrefs.SetFloat ("BASECOST", GameControl.control.baseCost);
PlayerPrefs.SetFloat ("COST", GameControl.control.cost);
PlayerPrefs.SetFloat ("CLICKPOWER", GameControl.control.clickPower);
PlayerPrefs.SetFloat ("COUNT", GameControl.control.count);
PlayerPrefs.SetFloat ("BASECOSTA", GameControl.control.baseCostA);
PlayerPrefs.SetFloat ("COSTA", GameControl.control.costA);
PlayerPrefs.SetFloat ("CLICKPOWERA", GameControl.control.clickPowerA);
PlayerPrefs.SetFloat ("COUNTA", GameControl.control.countA);
PlayerPrefs.SetFloat ("BASECOSTB", GameControl.control.baseCostB);
PlayerPrefs.SetFloat ("COSTB", GameControl.control.costB);
PlayerPrefs.SetFloat ("CLICKPOWERB", GameControl.control.clickPowerB);
PlayerPrefs.SetFloat ("COUNTB", GameControl.control.countB);
PlayerPrefs.SetFloat ("BASECOSTC", GameControl.control.baseCostC);
PlayerPrefs.SetFloat ("COSTC", GameControl.control.costC);
PlayerPrefs.SetFloat ("CLICKPOWERC", GameControl.control.clickPowerC);
PlayerPrefs.SetFloat ("COUNTC", GameControl.control.countC);
}
public void OnClick()
{
SaveAllInformation ();
Debug.Log ("Information Saved");
}
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
// SaveAllInformation ();
}
}
it seems to be saving and loading this much
GameControl.control.fish = PlayerPrefs.GetFloat (“TOTALFISH”);
GameControl.control.fishPerClick = PlayerPrefs.GetFloat (“FISHPERCLICK”);
GameControl.control.fishJewels = PlayerPrefs.GetFloat (“FISHJEWELS”);
GameControl.control.currentExperience = PlayerPrefs.GetFloat (“CURRENTXP”);
GameControl.control.fishingRank = PlayerPrefs.GetInt(“FISHINGRANK”);
GameControl.control.baseCost = PlayerPrefs.GetFloat (“BASECOST”);
GameControl.control.cost = PlayerPrefs.GetInt(“COST”);
GameControl.control.clickPower = PlayerPrefs.GetFloat (“CLICKPOWER”);
GameControl.control.count = PlayerPrefs.GetFloat (“COUNT”);
but the rest seems to not be saving or loading. I can’t seem to find if there is a limit on how many things you can save in the playerprefs save or not. that is my question, am i trying to save to many variables for playerprefs? thanks!