修复ArrayPool可能会产生报错的问题 (#451)
* Fixed ArrayPool conflict with CString.dll ArrayPool in Tolua Fixed ArrayPool conflict with CString.dll ArrayPool in Tolua * ScreenCapture在Unity2022中才支持 ScreenCapture在Unity2022中才支持,增加Unity版本判断main
parent
79b3255d0a
commit
2f2b56a20d
|
|
@ -345,7 +345,7 @@ namespace MCPForUnity.Editor.Services.Transport.Transports
|
|||
return null;
|
||||
}
|
||||
|
||||
byte[] rentedBuffer = ArrayPool<byte>.Shared.Rent(8192);
|
||||
byte[] rentedBuffer = System.Buffers.ArrayPool<byte>.Shared.Rent(8192);
|
||||
var buffer = new ArraySegment<byte>(rentedBuffer);
|
||||
using var ms = new MemoryStream(8192);
|
||||
|
||||
|
|
@ -381,7 +381,7 @@ namespace MCPForUnity.Editor.Services.Transport.Transports
|
|||
}
|
||||
finally
|
||||
{
|
||||
ArrayPool<byte>.Shared.Return(rentedBuffer);
|
||||
System.Buffers.ArrayPool<byte>.Shared.Return(rentedBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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}'");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue