diff --git a/MCPForUnity/Editor/Services/Transport/Transports/WebSocketTransportClient.cs b/MCPForUnity/Editor/Services/Transport/Transports/WebSocketTransportClient.cs index ae62aafa..f2beb1f4 100644 --- a/MCPForUnity/Editor/Services/Transport/Transports/WebSocketTransportClient.cs +++ b/MCPForUnity/Editor/Services/Transport/Transports/WebSocketTransportClient.cs @@ -345,7 +345,7 @@ private async Task ReceiveMessageAsync(CancellationToken token) 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 @@ private async Task ReceiveMessageAsync(CancellationToken token) } 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 81cefa31..1408f219 100644 --- a/MCPForUnity/Runtime/Helpers/ScreenshotUtility.cs +++ b/MCPForUnity/Runtime/Helpers/ScreenshotUtility.cs @@ -41,7 +41,9 @@ public static ScreenshotCaptureResult CaptureToAssetsFolder(string fileName = nu // 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}'");