Add Unity Pipeline package support

This commit is contained in:
ud18010
2026-07-31 17:34:04 +08:00
parent d1a526094e
commit 786b7ffff9
590 changed files with 51995 additions and 2 deletions
@@ -0,0 +1,55 @@
using Unity.Pipeline.Commands;
using UnityEditor;
using UnityEngine;
namespace Unity.Pipeline.Editor.Commands
{
/// <summary>
/// Commands for controlling Unity Editor play mode state.
/// Enables automation workflows to control Editor play/stop/pause from CLI tools.
/// </summary>
public static class PlayModeCommands
{
// TODO Pipeline: should all commands have name with namespace: editor.play build.generate instead of using _
[CliCommand("editor_play", "Enter Unity Editor play mode")]
public static string EnterPlayMode()
{
if (EditorApplication.isPlaying)
{
Debug.LogWarning("Editor is already in play mode");
return "Already in play mode";
}
EditorApplication.isPlaying = true;
return "Entered play mode";
}
[CliCommand("editor_stop", "Exit Unity Editor play mode")]
public static string ExitPlayMode()
{
if (!EditorApplication.isPlaying)
{
Debug.LogWarning("Editor is already in edit mode");
return "Already in edit mode";
}
EditorApplication.isPlaying = false;
return "Exited play mode";
}
[CliCommand("editor_pause", "Pause Unity Editor play mode")]
public static string PausePlayMode()
{
if (!EditorApplication.isPlaying)
{
Debug.LogWarning("Cannot pause - Editor is not in play mode");
return "Cannot pause - not in play mode";
}
EditorApplication.isPaused = !EditorApplication.isPaused;
string state = EditorApplication.isPaused ? "paused" : "unpaused";
return $"Play mode {state}";
}
}
}