private void LoadData() { // This can be read and written from multiple scripts at the same time. // It uses a file with a name. Returns null only if the name is invalid. // mScriptStorage = Game.GetSharedStorage(MY_SCRIPT_STORAGE_ID); // No file involved in with this method. // Data will not persist once the server restarts or the map is changed // While restarting sessions on the same map, the data will persist. // mScriptStorage = Game.SessionStorage; // This is tied to my script. It uses a file. mScriptStorage = Game.LocalStorage; if (mScriptStorage.ContainsKey(SHOTS_FIRED_KEY)) { if (!mScriptStorage.TryGetItemInt(SHOTS_FIRED_KEY, out mTotalShotsFiredCount)) { mTotalShotsFiredCount = 0; } } }
internal static bool Get(string key, out int value) { return(m_storage.TryGetItemInt(key, out value)); }