Copying and Pasting cs Code

In cs, like in almost any computer programming language, reading data from a file can be tricky. You add extra lines of code to tell the computer what to do. Sometimes you can copy and paste these lines from other peoples’ code.

For example, you can follow the pattern in this listing:

     private static void createData()
     {
#if UNITY_EDITOR
         PlayerPrefs.SetInt(KEY_COIN, 3000000);//GOLD
         PlayerPrefs.SetInt(KEY_WORLD_MAP, 1);//MAP UNLOCK 1
         for (int i = 0; i < 4; i++)
         {
             PlayerPrefs.SetInt(KEY_LEVEL + i, 15);//LEVEL UNLOCK INSIDE MAP 1
         }
         for (int i = 0; i < 60; i++)
         {
             PlayerPrefs.SetInt(KEY_STAR + i, 3);//STAR 0
         }
#else
         PlayerPrefs.SetInt(KEY_COIN, 3000);//GOLD 3000
          PlayerPrefs.SetInt(KEY_WORLD_MAP, 1);//MAP UNLOCK 1
         for (int i = 0; i < 4; i++)
         {
             PlayerPrefs.SetInt(KEY_LEVEL + i, 1);//LEVEL UNLOCK INSIDE MAP 1
         }
         for (int i = 0; i < 60; i++)
         {
             PlayerPrefs.SetInt(KEY_STAR + i, 0);//STAR 0
         }
#endif
         for (int i = 0; i < 2; i++)
             for (int j = 0; j < 10; j++)
             {
                 PlayerPrefs.SetInt(KEY_UPGRADE + i + "" + j, 1);
             }
         PlayerPrefs.SetInt(KEY_ANIMAL_UNLOCK + "0", 1);
         for (int i = 1; i < 10; i ++ )
             PlayerPrefs.SetInt(KEY_ANIMAL_UNLOCK + i, 0);
         PlayerPrefs.SetInt(KEY_GUIDE, 0);

         PlayerPrefs.Save();
     }