Unity 5 - Playerprefs saving in unity but not on android?

[postlink] https://the-best-way-of-life-is-islam.blogspot.com/2015/07/unity-5-playerprefs-saving-in-unity-but.html [/postlink]

I have this attached to my hero object that gets destroyed . Could that be part of the problem? All I want to do is save the highscore then display it on my start scene. Here is the code:

public int highscore; 
public int score;   


void AddPoint1()
{


    if (score > highscore) {
        highscore = score;
        PlayerPrefs.SetInt ("highscore", score);
        PlayerPrefs.Save ();

    }
}

Here is second script attached to empty object in start scene (different scene)

void OnGUI()
{ 
    GUI.Label (new Rect (Screen.width / 2, Screen.height/2, 100, 100), "Highscore: " + PlayerPrefs.GetInt("highscore"), customGuistyle);
}

اذا أعجبك الموضوع ساهم في نشره :

Enregistrer un commentaire

 
حقوق النشر: Published by | Template Created by | القناة على اليوتيب
copyright © 2014. The Best Way Of Life Is Islam -يمكن نقل كل ما هو موجود في موقع الرحمة تيوب
القرآن الكريم و الأحاديث النبوية أناشيد و دروس اسلامية منوعة موقع الفيديوهات الاسلامية
تطوير و تعريب مدونة ثعلوب