commit
a041f188b6
|
@ -15,6 +15,10 @@ namespace UnityEngine.UI.Extensions
|
||||||
parentCanvas = rt.GetComponentInParent<Canvas>();
|
parentCanvas = rt.GetComponentInParent<Canvas>();
|
||||||
if (parentCanvas == null)
|
if (parentCanvas == null)
|
||||||
{
|
{
|
||||||
|
if (parent.parent == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
parent = parent.parent.GetComponent<RectTransform>();
|
parent = parent.parent.GetComponent<RectTransform>();
|
||||||
SearchIndex++;
|
SearchIndex++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,11 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
canvas = GetComponentInParent<RectTransform>().GetParentCanvas().GetComponent<RectTransform>();
|
var canvasParent = GetComponentInParent<RectTransform>().GetParentCanvas();
|
||||||
|
if (canvasParent != null)
|
||||||
|
{
|
||||||
|
canvas = canvasParent.GetComponent<RectTransform>();
|
||||||
|
}
|
||||||
rt = GetComponent<RectTransform>();
|
rt = GetComponent<RectTransform>();
|
||||||
lr = GetComponent<UILineRenderer>();
|
lr = GetComponent<UILineRenderer>();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue