private void OnPlayGame(object argument) { IsInPlayMode = true; m_prePlayModeLevelReference = OpenedLevelAsset; UndoRedoModel.IsRecording = false; UndoRedoModel.Purge(null); CViewportViewModel viewport = GetTool <CViewportViewModel>(); viewport.IsVisible = true; viewport.IsActive = true; viewport.LockMouseCursor(); CEngine.Instance.Dispatch(EEngineUpdatePriority.BeginFrame, () => { CWorld world = CEngine.Instance.CurrentWorld; m_prePlayModeLevel = new CLevelAsset(world.LoadedLevel, "EditorTempLevel"); world.StartPlayMode(); Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => { })); }); }