public IEnumerator LoadDataRoutine()
        {
            string filePath = "";

            if (Application.platform == RuntimePlatform.Android)
            {
                filePath = "jar:file://" + Application.dataPath + "!/assets";
            }
            else if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                filePath = Application.dataPath + "/Raw";
            }
            else
            {
                filePath = Application.dataPath + "/StreamingAssets";
            }
            filePath += "/playfab.data";
            FileStream      file = null;
            BinaryFormatter bf   = new BinaryFormatter();
            PlayfabGameData data = null;

            if (Application.platform == RuntimePlatform.Android | Application.platform == RuntimePlatform.WindowsWebPlayer | Application.platform == RuntimePlatform.OSXWebPlayer)
            {
                WWW www = new WWW(filePath);
                yield return(www);

                using (MemoryStream ms = new MemoryStream(www.bytes))
                {
                    data = (PlayfabGameData)bf.Deserialize(ms);
                }
            }
            else
            {
                file = File.Open(Application.streamingAssetsPath + "/playfab.data", FileMode.Open, FileAccess.Read, FileShare.None);
                data = (PlayfabGameData)bf.Deserialize(file);
                file.Close();
            }
            TitleId = data.TitleId;
            if (PlayFabSettings.TitleId == null)
            {
                PlayFabSettings.TitleId = TitleId;
            }
            CatalogVersion = data.CatalogVersion;
            KeepSessionKey = data.KeepSessionKey;
            SkipLogin      = data.SkipLogin;

            if (KeepSessionKey && PlayFabClientAPI.AuthKey == null && data.AuthKey != null)
            {
                PlayFabClientAPI.AuthKey = AuthKey = data.AuthKey;
                Debug.Log("Retrieved auth key: " + AuthKey);
            }
            else if (KeepSessionKey && PlayFabClientAPI.AuthKey != null && data.AuthKey == null)
            {
                SaveData();
            }
        }
        public static void SaveData()
        {
            string folderPath = Path.GetDirectoryName(Application.streamingAssetsPath + "/playfab.data");

            if (!Directory.Exists(folderPath))
            {
                Directory.CreateDirectory(folderPath);
            }
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Create(Application.streamingAssetsPath + "/playfab.data");

            PlayfabGameData data = new PlayfabGameData();

            data.TitleId        = TitleId;
            data.CatalogVersion = CatalogVersion;
            data.KeepSessionKey = KeepSessionKey;
            data.SkipLogin      = SkipLogin;
            if (KeepSessionKey && PlayFabClientAPI.AuthKey != null)
            {
                data.AuthKey = AuthKey = PlayFabClientAPI.AuthKey;
            }
            bf.Serialize(file, data);
            file.Close();
        }