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