In Unity, how to tell if it's the first time a game is being opened?

Use PlayerPrefs. Check if key exist. If the key does not exist, return default value 1 and that is first time opening. Also, If this is first time opening set that key to 0 so that if will never return 1 again. So any value that is not 1 means that it is not the first time opening. In this example we can call the key FIRSTTIMEOPENING.

if (PlayerPrefs.GetInt("FIRSTTIMEOPENING", 1) == 1)
{
    Debug.Log("First Time Opening");

    //Set first time opening to false
    PlayerPrefs.SetInt("FIRSTTIMEOPENING", 0);

    //Do your stuff here

}
else
{
    Debug.Log("NOT First Time Opening");

    //Do your stuff here
}

Tags:

C#

Unity3D

Unity5