/* ┌──────────────────────────────────────────────────────────────────┐ │ Author: Ivan Murzak (https://github.com/IvanMurzak) │ │ Repository: GitHub (https://github.com/IvanMurzak/Unity-MCP) │ │ Copyright (c) 2025 Ivan Murzak │ │ Licensed under the Apache License, Version 2.0. │ │ See the LICENSE file in the project root for more information. │ └──────────────────────────────────────────────────────────────────┘ */ #nullable enable using com.IvanMurzak.Unity.MCP.Editor.UI; using com.IvanMurzak.Unity.MCP.Editor.Utils; using com.IvanMurzak.Unity.MCP.Utils; using UnityEditor; using UnityEngine; using ILogger = Microsoft.Extensions.Logging.ILogger; namespace com.IvanMurzak.Unity.MCP.Editor { [InitializeOnLoad] public static partial class Startup { static readonly ILogger _logger = UnityLoggerFactory.LoggerFactory.CreateLogger(nameof(Startup)); static Startup() { UnityMcpPluginEditor.Instance.BuildMcpPluginIfNeeded(); UnityMcpPluginEditor.Instance.AddUnityLogCollectorIfNeeded(() => new BufferedFileLogStorage()); if (Application.dataPath.Contains(" ")) Debug.LogError("The project path contains spaces, which may cause issues during usage of AI Game Developer. Please consider the move the project to a folder without spaces."); SubscribeOnEditorEvents(); // Initialize sub-systems API.Tool_Tests.Init(); UpdateChecker.Init(); PackageUtils.Init(); // Auto-generate skill files for the selected agent if enabled var savedAgentId = MainWindowEditor.selectedAiAgentId.Value; var agent = AiAgentConfiguratorRegistry.GetByAgentId(savedAgentId); if (agent?.SupportsSkills == true && UnityMcpPluginEditor.IsAutoGenerateSkills(agent.AgentId)) { UnityMcpPluginEditor.SkillsPath = agent.SkillsPath!; UnityMcpPluginEditor.Instance.McpPluginInstance!.GenerateSkillFiles(UnityMcpPluginEditor.ProjectRootPath); } } } }