check cursor texture size.

This commit is contained in:
hecomi
2016-11-02 14:59:15 +09:00
parent ad4b49c177
commit f2cad8bf73
+6 -2
View File
@@ -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);
}