public virtual async UniTask <GameStateMap> LoadGameAsync(string slotId) { if (string.IsNullOrEmpty(slotId) || !GameSlotManager.SaveSlotExists(slotId)) { throw new Exception($"Slot '{slotId}' not found when loading '{typeof(GameStateMap)}' data."); } var quick = slotId.EqualsFast(LastQuickSaveSlotId); OnGameLoadStarted?.Invoke(new GameSaveLoadArgs(slotId, quick)); if (Configuration.LoadStartDelay > 0) { await UniTask.Delay(TimeSpan.FromSeconds(Configuration.LoadStartDelay)); } Engine.Reset(); await Resources.UnloadUnusedAssets(); var state = await GameSlotManager.LoadAsync(slotId); await LoadAllServicesFromStateAsync <IStatefulService <GameStateMap>, GameStateMap>(state); // All the serialized snapshots are expected to allow player rollback. RollbackStack?.OverrideFromJson(state.RollbackStackJson, s => s.AllowPlayerRollback()); await PerformOnGameDeserializeTasksAsync(state); OnGameLoadFinished?.Invoke(new GameSaveLoadArgs(slotId, quick)); return(state); }