Hey guys,
the first time I’m populating a GridLayoutGroup with game objects, everything’s fine.
However, at each subsequent try to add children to it after having it cleared, the following error is logged:
MissingReferenceException: The object of type 'RectTransform' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.DrivenRectTransformTracker.Add (UnityEngine.Object driver, UnityEngine.RectTransform rectTransform, DrivenTransformProperties drivenProperties) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/RectTransformBindings.gen.cs:64)
UnityEngine.UI.GridLayoutGroup.SetCellsAlongAxis (Int32 axis) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/GridLayoutGroup.cs:115)
UnityEngine.UI.GridLayoutGroup.SetLayoutHorizontal () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/GridLayoutGroup.cs:92)
UnityEngine.UI.LayoutRebuilder.<Rebuild>m__9 (UnityEngine.Component e) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs:71)
UnityEngine.UI.LayoutRebuilder.PerformLayoutControl (UnityEngine.RectTransform rect, UnityEngine.Events.UnityAction`1 action) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs:103)
UnityEngine.UI.LayoutRebuilder.PerformLayoutControl (UnityEngine.RectTransform rect, UnityEngine.Events.UnityAction`1 action) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs:106)
UnityEngine.UI.LayoutRebuilder.PerformLayoutControl (UnityEngine.RectTransform rect, UnityEngine.Events.UnityAction`1 action) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs:106)
UnityEngine.UI.LayoutRebuilder.PerformLayoutControl (UnityEngine.RectTransform rect, UnityEngine.Events.UnityAction`1 action) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs:106)
UnityEngine.UI.LayoutRebuilder.Rebuild (CanvasUpdate executing) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs:71)
UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/CanvasUpdateRegistry.cs:122)
UnityEngine.Canvas:SendWillRenderCanvases()
It might be worth noting that the game object with the layout group is disabled and enabled in between.
We are using Unity 5.3.2p3.
Anyone else experiencing these issues?