Hi, I have a problem related to canvas groups:
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.UI.Selectable.ParentGroupAllowsInteraction () (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Selectable.cs:445)
UnityEngine.UI.Selectable.OnEnable () (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Selectable.cs:521)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
bool ParentGroupAllowsInteraction()
{
Transform t = transform;
while (t != null)
{
t.GetComponents(m_CanvasGroupCache); //<- "m_CanvasGroupCache" is null...
for (var i = 0; i < m_CanvasGroupCache.Count; i++) // throws here
{
if (m_CanvasGroupCache[i].enabled && !m_CanvasGroupCache[i].interactable)
return false;
if (m_CanvasGroupCache[i].ignoreParentGroups)
return true;
}
t = t.parent;
}
return true;
}
It is Called OnEnable(), also in the editor outside of play mode, and while playing and the parenting canvas group has changed. I am overriding the Selectable class, but this is the only instance where it causes a problem, and it still works fine I just get this error for some reason. is anyone has any idea why this happens and how do i get this fixed? or where to check?
I cant see anything suspicious in my part of the code.
I restarted unity.
I rebooted my pc...
