It is my normal practice in my every game. First I'd like you to add a small script named Utils.cs made by me that I do use in my every game. No such requirement but easy to handle these kind of stuff. Main benifit of this script is you can use bool in PlayerPrefs through int.
Utils.cs
using UnityEngine; using System.Collections; public class Utils : MonoBehaviour { public static void SetInt (string key, int value) { PlayerPrefs.SetInt (key, value); } public static int GetInt (string key) { return PlayerPrefs.GetInt (key); } public static void SetString (string key, string value) { PlayerPrefs.SetString (key, value); } public static string GetString (string key) { return PlayerPrefs.GetString (key); } public static void SetBool (string key, bool value) { if (value) PlayerPrefs.SetInt (key, 1); else PlayerPrefs.SetInt (key, 0); } public static bool GetBool (string key) { int val = PlayerPrefs.GetInt (key); if (val == 1) return true; return false; } }
Now in any script that runs only once per game launch (script in splash screen for example), you can handle very first launch like,
SplashScreen script
void Start() { if (!Utils.GetBool ("isAppLaunchedFirstTime")) { Utils.SetBool ("isAppLaunchedFirstTime", true); //TODO: Set initial coins //TODO: Set sound flag to true //TODO: Set tutorial flag to true //TODO: Whatever you want to do only once } }