Its tough posting it as a comment so I ll post it as a new answer
Script.cs
private int ruby = script1.ruby1;
private int saffire = script1.saffire1;
private int emarald = script1.emerald1;
private int jetpack = script 1.jetpack1;
void OnCollisionEnter(col:Collision)
{
If (col.gameObject.tag == "Ruby"){
ruby += 1;
}
Else If (col.gameObject.tag == "Saffire") {
saffire += 1;
}
Else If (col.gameObject.tag == "Emerald") {
Emerald += 1;
}
Else if (col.gameObject.tag == "Jetpack"
{
Jetpack += 1;
}
void Update ()
{
If (ruby != PlayerPrefs.GetInt("Ruby") {
PlayerPrefs.SetInt ("Ruby",ruby);
}
If (ruby != PlayerPrefs.GetInt("Saffire") {
PlayerPrefs.SetInt ("Saffire",saffire);
}
If (ruby != PlayerPrefs.GetInt("Emerald") {
PlayerPrefs.SetInt ("Emerald",emerald);
}
If (ruby != PlayerPrefs.GetInt("Jetpack") {
PlayerPrefs.SetInt ("Jetpack",jetpack);
}
Now script1.cs (To be placed wherever the game begins)
private int ruby1;
private int saffire1;
private int emerald1;
private int jetpack1;
void Start ()
{
ruby1 = PlayerPrefs.GetInt ("Ruby");
saffire1 = PlayerPrefs.GetInt ("Saffire");
emerald1 = PlayerPrefs.GetInt ("Emerald");
jetpack1 = PlayerPrefs.GetInt ("Jetpack");
}
Untested but should work
Trending Articles
More Pages to Explore .....