From f2cad8bf7313ce3f43413a536d5f3e6e435b3d48 Mon Sep 17 00:00:00 2001 From: hecomi Date: Wed, 2 Nov 2016 14:59:15 +0900 Subject: [PATCH] check cursor texture size. --- Assets/uDesktopDuplication/Scripts/Cursor.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Assets/uDesktopDuplication/Scripts/Cursor.cs b/Assets/uDesktopDuplication/Scripts/Cursor.cs index a85eb6d..3a030b4 100644 --- a/Assets/uDesktopDuplication/Scripts/Cursor.cs +++ b/Assets/uDesktopDuplication/Scripts/Cursor.cs @@ -65,9 +65,13 @@ public class Cursor : MonoBehaviour void UpdateTexture() { - var scale = new Vector2(monitor.pointerShapeWidth, monitor.pointerShapeHeight); + var w = monitor.pointerShapeWidth; + var h = monitor.pointerShapeHeight; + if (w == 0 || h == 0) return; + + var scale = new Vector2(w, h); if (!pointerTextures_.ContainsKey(scale)) { - var texture = new Texture2D(monitor.pointerShapeWidth, monitor.pointerShapeHeight, TextureFormat.BGRA32, false); + var texture = new Texture2D(w, h, TextureFormat.BGRA32, false); texture.wrapMode = TextureWrapMode.Clamp; pointerTextures_.Add(scale, texture); }