From b4db3b211416cd40a5a5000ab44683ffe0d4d312 Mon Sep 17 00:00:00 2001 From: pharan Date: Thu, 2 Aug 2018 10:20:46 +0800 Subject: [PATCH] [unity] Handle varying CopyTexture support. --- .../Modules/AttachmentTools/AttachmentTools.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/AttachmentTools/AttachmentTools.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/AttachmentTools/AttachmentTools.cs index 9b3deeeca..985c2cddc 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/AttachmentTools/AttachmentTools.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/AttachmentTools/AttachmentTools.cs @@ -619,7 +619,14 @@ namespace Spine.Unity.Modules.AttachmentTools { } static void CopyTexture (Texture2D source, Rect sourceRect, Texture2D destination) { - Graphics.CopyTexture(source, 0, 0, (int)sourceRect.x, (int)sourceRect.y, (int)sourceRect.width, (int)sourceRect.height, destination, 0, 0, 0, 0); + if (SystemInfo.copyTextureSupport == UnityEngine.Rendering.CopyTextureSupport.None) { + // GetPixels fallback for old devices. + Color[] pixelBuffer = source.GetPixels((int)sourceRect.x, (int)sourceRect.y, (int)sourceRect.width, (int)sourceRect.height); + destination.SetPixels(pixelBuffer); + destination.Apply(); + } else { + Graphics.CopyTexture(source, 0, 0, (int)sourceRect.x, (int)sourceRect.y, (int)sourceRect.width, (int)sourceRect.height, destination, 0, 0, 0, 0); + } } static bool IsRenderable (Attachment a) {