From df39a76f3cd8b9fe26b185d5869edbf07578954b Mon Sep 17 00:00:00 2001 From: "Simon (darkside) Jackson" Date: Mon, 23 May 2016 21:30:06 +0100 Subject: [PATCH] Added patch to limit the Reorderable List component to Screenspace-Overlay canvases for now to avoid issues until it can be updated. --HG-- branch : develop_5.3 --- Scripts/ReorderableList/ReorderableList.cs | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Scripts/ReorderableList/ReorderableList.cs b/Scripts/ReorderableList/ReorderableList.cs index df876d7..cb2ee35 100644 --- a/Scripts/ReorderableList/ReorderableList.cs +++ b/Scripts/ReorderableList/ReorderableList.cs @@ -44,6 +44,28 @@ namespace UnityEngine.UI.Extensions } } + Canvas GetCanvas() + { + Transform t = transform; + Canvas canvas = null; + + + int lvlLimit = 100; + int lvl = 0; + + while (canvas == null && lvl < lvlLimit) + { + canvas = t.gameObject.GetComponent(); + if (canvas == null) + { + t = t.parent; + } + + lvl++; + } + return canvas; + } + private void Awake() { @@ -60,7 +82,12 @@ namespace UnityEngine.UI.Extensions { Debug.LogError("You need to have a Graphic control (such as an Image) for the list [" + name + "] to be droppable", gameObject); return; - } + } + if (GetCanvas().renderMode != RenderMode.ScreenSpaceOverlay) + { + Debug.LogError("The ReOrderable List is only supported on a Screenspace-Overlay Canvas at the moment"); + } + _listContent = ContentLayout.gameObject.AddComponent(); _listContent.Init(this); }