From 00b67b70464096bdee58109da83e2c4ca0e75fb6 Mon Sep 17 00:00:00 2001 From: Simon Jackson Date: Sun, 18 Dec 2022 18:09:58 +0000 Subject: [PATCH] Updated Points to always be an array of 1 when set to nothing. Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/295 --- Runtime/Scripts/Primitives/UILineRenderer.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Runtime/Scripts/Primitives/UILineRenderer.cs b/Runtime/Scripts/Primitives/UILineRenderer.cs index 6f2f093..d3b5d3d 100644 --- a/Runtime/Scripts/Primitives/UILineRenderer.cs +++ b/Runtime/Scripts/Primitives/UILineRenderer.cs @@ -111,10 +111,18 @@ namespace UnityEngine.UI.Extensions set { - if (m_points == value) - return; - m_points = value; - SetAllDirty(); + if (m_points == value) return; + + if (value == null || value.Length == 0) + { + m_points = new Vector2[1]; + } + else + { + m_points = value; + } + + SetAllDirty(); } }