how do a auto load ??
hi! i have a auto save but i cant do a auto load when the program start. my save code is
using UnityEngine;
using System.Collections;
public class Save : MonoBehaviour {
float saveTimer = 0.0f;
void Update(){
saveTimer += 1.0f * Time.deltaTime;
if(saveTimer > 30.0f){
saveTimer = 0.0f;
SaveGame();
PlayerPrefs.SetFloat("gold", GetComponent<Click>().Gold);
PlayerPrefs.SetFloat("goldperclick", GetComponent<Click>().goldperclick);
PlayerPrefs.SetFloat("cost", GetComponent<ItemMananger2>().cost);
PlayerPrefs.SetFloat("cost", GetComponent<updatemananger>().cost);
}
}
void SaveGame()
{
GetComponent<Click>().Gold = PlayerPrefs.GetFloat("gold");
GetComponent<Click>().goldperclick = PlayerPrefs.GetFloat("goldperclick");
GetComponent<ItemMananger2>().cost = PlayerPrefs.GetFloat("cost");
GetComponent<updatemananger>().cost = PlayerPrefs.GetFloat("cost");
GetComponent<updatemananger>().count=PlayerPrefs.GetInt("count");
GetComponent<ItemMananger2>().count=PlayerPrefs.GetInt("count");
}
some can help to do the load?
Comment
Your answer
Follow this Question
Related Questions
WebGl taking too long to load. size is large 1 Answer
Unity won't load!!!! 2 Answers
Auto save and auto load on quit app. 1 Answer
2D player sliding after scene transition 0 Answers