diff --git a/MCPForUnity/Editor/Services/Transport/Transports/WebSocketTransportClient.cs b/MCPForUnity/Editor/Services/Transport/Transports/WebSocketTransportClient.cs index ae62aaf..f2beb1f 100644 --- a/MCPForUnity/Editor/Services/Transport/Transports/WebSocketTransportClient.cs +++ b/MCPForUnity/Editor/Services/Transport/Transports/WebSocketTransportClient.cs @@ -345,7 +345,7 @@ namespace MCPForUnity.Editor.Services.Transport.Transports return null; } - byte[] rentedBuffer = ArrayPool.Shared.Rent(8192); + byte[] rentedBuffer = System.Buffers.ArrayPool.Shared.Rent(8192); var buffer = new ArraySegment(rentedBuffer); using var ms = new MemoryStream(8192); @@ -381,7 +381,7 @@ namespace MCPForUnity.Editor.Services.Transport.Transports } finally { - ArrayPool.Shared.Return(rentedBuffer); + System.Buffers.ArrayPool.Shared.Return(rentedBuffer); } } diff --git a/MCPForUnity/Runtime/Helpers/ScreenshotUtility.cs b/MCPForUnity/Runtime/Helpers/ScreenshotUtility.cs index 81cefa3..1408f21 100644 --- a/MCPForUnity/Runtime/Helpers/ScreenshotUtility.cs +++ b/MCPForUnity/Runtime/Helpers/ScreenshotUtility.cs @@ -41,7 +41,9 @@ namespace MCPForUnity.Runtime.Helpers // Use only the file name to let Unity decide the final location (per CaptureScreenshot docs). string captureName = Path.GetFileName(normalizedFullPath); +#if UNITY_2022_1_OR_NEWER ScreenCapture.CaptureScreenshot(captureName, size); +#endif Debug.Log($"Screenshot requested: file='{captureName}' intendedFullPath='{normalizedFullPath}' persistentDataPath='{Application.persistentDataPath}'");