private async void OnSceneLoaded(EventArgs arg) { FSceneLoadedEventArg eventArg = (FSceneLoadedEventArg)arg; CLevelConfiguration metadata = FindObjectOfType <CLevelConfiguration>(); if (metadata == null) { FLog.Warning(CLASS_TYPE.Name, $"Cannot find scene metadata `S{eventArg.Scene.name}`"); } else if (metadata.GameMode == null) { FLog.Warning(CLASS_TYPE.Name, $"GameMode is not sat for this level."); } else { _currentGameMode = Activator.CreateInstance(metadata.GameMode.Type) as IGameMode; await _currentGameMode?.PreInitializeAsync(); await _currentGameMode?.InitializeAsync(); await _currentGameMode?.BeginPlayAsync(); FEventManager.Publish(FEventManager.ON_GAME_MODE_LOADED); } }