Skip to main content
Glama
McpLog.cs1.73 kB
using MCPForUnity.Editor.Constants; using UnityEditor; using UnityEngine; namespace MCPForUnity.Editor.Helpers { internal static class McpLog { private const string InfoPrefix = "<b><color=#2EA3FF>MCP-FOR-UNITY</color></b>:"; private const string DebugPrefix = "<b><color=#6AA84F>MCP-FOR-UNITY</color></b>:"; private const string WarnPrefix = "<b><color=#cc7a00>MCP-FOR-UNITY</color></b>:"; private const string ErrorPrefix = "<b><color=#cc3333>MCP-FOR-UNITY</color></b>:"; private static volatile bool _debugEnabled = ReadDebugPreference(); private static bool IsDebugEnabled() => _debugEnabled; private static bool ReadDebugPreference() { try { return EditorPrefs.GetBool(EditorPrefKeys.DebugLogs, false); } catch { return false; } } public static void SetDebugLoggingEnabled(bool enabled) { _debugEnabled = enabled; try { EditorPrefs.SetBool(EditorPrefKeys.DebugLogs, enabled); } catch { } } public static void Debug(string message) { if (!IsDebugEnabled()) return; UnityEngine.Debug.Log($"{DebugPrefix} {message}"); } public static void Info(string message, bool always = true) { if (!always && !IsDebugEnabled()) return; UnityEngine.Debug.Log($"{InfoPrefix} {message}"); } public static void Warn(string message) { UnityEngine.Debug.LogWarning($"{WarnPrefix} {message}"); } public static void Error(string message) { UnityEngine.Debug.LogError($"{ErrorPrefix} {message}"); } } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/CoplayDev/unity-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server