public static GTGameID LoadSetting() { GTGameID data = null; TextAsset binarydata = Resources.Load<TextAsset>("GoPlaySDKSetting"); if (binarydata == null) { // setting is not set return new GTGameID(); } try { Stream ms = new MemoryStream(binarydata.bytes); try { BinaryFormatter formatter = new BinaryFormatter(); data = (GTGameID)formatter.Deserialize(ms); } catch (SerializationException e) { Debug.LogError(e.Message); } finally { ms.Close(); } } catch (FileNotFoundException e) { Debug.Log("Load Gtoken Setting: " + e.Message); data = new GTGameID(); } return data; }
void OnEnable() { hideFlags = HideFlags.HideAndDontSave; if (data == null) { data = GTGameID.LoadSetting(); } }
// Start Session public Session() { gameId = GTGameID.LoadSetting(); // Look for cache session SessionId = PlayerPrefs.GetString(GOPLAY_Session, string.Empty); }