static void RecordToggle(CommandExecuteContext context) { if (ProcessService.level == ProcessLevel.UMP_MASTER && ProcessService.IsChannelServiceStarted() && ProcessService.GetSlaveProcessState(s_SlaveProcessId) == ProcessState.UMP_RUNNING && EventService.IsConnected) { EventService.Request(nameof(EventType.UmpProfilerRecordToggle), (err, args) => { bool recording = false; if (err == null) { // Recording was toggled by profiler OOP recording = (bool)args[0]; ProfilerDriver.enabled = recording; } else { if (!EditorWindow.HasOpenInstances <ProfilerWindow>()) { return; } // Toggle profiling in-process recording = !ProfilerDriver.enabled; ProfilerDriver.profileEditor = !EditorApplication.isPlaying; var profilerWindow = EditorWindow.GetWindow <ProfilerWindow>(); if (profilerWindow) { profilerWindow.SetRecordingEnabled(recording); } else { ProfilerDriver.enabled = recording; } } if (recording) { Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, "Recording has started..."); } else { Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, "Recording has ended."); } }, 250); context.result = true; } else { context.result = false; } }
private static object ExecuteCommand(string id, CommandHint hint, object[] args) { if (!Exists(id)) { throw new ArgumentException($"Command {id} does not exist", nameof(id)); } var command = s_Commands[id]; if ((command.hint & hint) == 0) { throw new ArgumentException($"Command ({id}, {command.hint}) does not match the hinting {hint}", nameof(id)); } var context = new CommandExecuteContext { hint = hint, args = args, result = null }; command.handler(context); return(context.result); }
internal static void Refresh(CommandExecuteContext c) { LoadModes(); }
static void OnEnableDeepProfilingCommand(CommandExecuteContext ctx) { OnProfilerWindowDeepProfileChanged(ProfilerDriver.deepProfiling); }
static void OnRecordCommand(CommandExecuteContext ctx) { s_SlaveProfilerWindow.SetRecordingEnabled(!s_SlaveProfilerWindow.IsRecording()); Menu.SetChecked("Edit/Record", s_SlaveProfilerWindow.IsRecording()); }
static void OnSaveProfileDataFileCommand(CommandExecuteContext ctx) { s_SlaveProfilerWindow.SaveProfilingData(); }
static void OnLoadProfileDataFileCommand(CommandExecuteContext ctx) { s_SlaveProfilerWindow.LoadProfilingData(false); }
[UsedImplicitly, RequiredSignature] static void RequiredSignature(CommandExecuteContext context) { }
internal static void TryForceExitSafeModeMenu(CommandExecuteContext context) { TryForceExitSafeMode(); }