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
release
Simon (darkside) Jackson 2016-05-23 21:30:06 +01:00
parent 2b0c2d805a
commit df39a76f3c
1 changed files with 28 additions and 1 deletions

View File

@ -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<Canvas>();
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<ReorderableListContent>();
_listContent.Init(this);
}