| 1234567891011121314151617181920212223242526272829 |
- using UnityEditor;
- using UnityEngine;
- public static class UnityMcpPackageSetup
- {
- public const string PackageName = "com.coplaydev.unity-mcp";
- public const string PackageUrl = "https://github.com/CoplayDev/unity-mcp.git?path=/MCPForUnity#main";
- static readonly EditorPackageInstaller Installer = new EditorPackageInstaller(
- PackageName, PackageUrl, "Unity MCP", "AppRuntimes.UnityMcp", "Use AppSettings/Install Unity MCP.");
- public static bool IsInstalled => Installer.IsInstalled;
- public static bool IsInstalling => Installer.IsInstalling;
- public static string LastError => Installer.LastError;
- [MenuItem("AppSettings/Install Unity MCP", false, 101)]
- public static void Install()
- {
- if (IsInstalled)
- {
- Debug.Log("[AppRuntimes] Unity MCP is already installed.");
- return;
- }
- Installer.Retry();
- }
- [MenuItem("AppSettings/Install Unity MCP", true, 101)]
- static bool CanInstall() => !IsInstalling && !EditorApplication.isCompiling && !EditorApplication.isUpdating
- && !EditorApplication.isPlayingOrWillChangePlaymode && !BuildPipeline.isBuildingPlayer;
- }
|