I’m having a small Issues with playerprefs i’ve got it so it saves the Score of my game and loads it
but i’m trying to get to to accumulate scores for an unlock level system any help with this would be great thanks
and yes i know the code doesn’t look good at the moments but its still working process
MainMenu Level Script
var score : int = 0;
var ScoreText : Text;
private var MainScore : int = 0;
function Start ()
{
score = PlayerPrefs.GetInt("Score", score);
MainScore = PlayerPrefs.GetInt("MainScore", score);
}
function Update ()
{
ScoreText.text = "Score :" + score;
//ScoreText.text = "Score :" + MainScore;
if (score >=10)
{
PlayerPrefs.SetInt("MainScore", MainScore);
}
if (score >=150)
{
gameObject.Find("Main Camera").SendMessage("Unlock1");
PlayerPrefs.SetInt("MainScore", score);
}
}
Saved From PlayLevel Script
function SaveScore ()
{
PlayerPrefs.SetInt("Score", score);
}