At first I’d like to apologize for my bad english, I’m form Poland
Here is my problem. I have my coin script and the other one, that counts number of how many I collect them in one round and then saves state as highscore. I want it to save state from all rounds like that(like a bank account):
Account = number of coins collected in all previous rounds + number of coins collected in round that I just finished
Here is my script that I’m using for collecting and saving higscore. What I have to do to create account instead of highscore?
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ScoreSystemCS : MonoBehaviour {
public static int myScore;
public int highScore1;
Text scoreText1;
Text highText1;
public void Start(){
myScore = 0;
highScore1 = PlayerPrefs.GetInt("HighScore1",0);
scoreText1 = GameObject.Find ("scoreText1").GetComponent<Text>();
highText1 = GameObject.Find ("highText1").GetComponent<Text>();
}
public void Update(){
scoreText1.text = ("myScore: " + myScore);
highText1.text = ("Account: " + highScore1);
}
public void CheckHighscore(){
if (myScore > highScore1) {
Debug.Log ("Saving Score");
PlayerPrefs.SetInt ("HighScore", myScore);
}
}
}