All my Material Components have lost their connections

0 votes
asked Jan 9, 2017 in Issue by Ian Grant

Hi, I re-opended a unity project after the Christmas break and I now have errors that weren't apparent before.

Basically all my material UI components on a multipage UI have lost their own 'internal' references to their sub-components.

Screenshot of missing objects / components

 

I am using gitbucket so don't know if something is corrupt in the submit..

The following error clocks up on launch...

NullReferenceException: Object reference not set to an instance of an object
MaterialUI.MaterialSlider.OnEditorUpdate () (at Assets/MaterialUI/Scripts/Components/MaterialSlider.cs:796)
MaterialUI.EditorUpdate.Update () (at Assets/MaterialUI/Scripts/MaterialUtils/EditorUpdate.cs:48)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/EditorApplicationBindings.gen.cs:222)

And the following: 

UnassignedReferenceException: The variable m_SliderContentTransform of MaterialSlider has not been assigned.
You probably need to assign the m_SliderContentTransform variable of the MaterialSlider script in the inspector.
UnityEngine.DrivenRectTransformTracker.Add (UnityEngine.Object driver, UnityEngine.RectTransform rectTransform, DrivenTransformProperties drivenProperties) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/RectTransformBindings.gen.cs:66)
MaterialUI.MaterialSlider.SetTracker () (at Assets/MaterialUI/Scripts/Components/MaterialSlider.cs:778)
MaterialUI.MaterialSlider.SetLayoutHorizontal () (at Assets/MaterialUI/Scripts/Components/MaterialSlider.cs:1310)
UnityEngine.UI.LayoutRebuilder.<Rebuild>m__9 (UnityEngine.Component e) (at /Users/builduser/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 /Users/builduser/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs:103)
UnityEngine.UI.LayoutRebuilder.Rebuild (CanvasUpdate executing) (at /Users/builduser/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/LayoutRebuilder.cs:71)
UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at /Users/builduser/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/CanvasUpdateRegistry.cs:122)
UnityEngine.Canvas:SendWillRenderCanvases()


And loads of these appear on play.

NullReferenceException: Object reference not set to an instance of an object
MaterialUI.MaterialCheckbox.OnEnable () (at Assets/MaterialUI/Scripts/Components/MaterialCheckbox.cs:83)

 

Any ideas before I manually reconnect all of them?

 

commented Jan 10, 2017 by admin (31,720 points)
Hi Ian,

Did you open the project with the same Unity version as the last time before the break?

If so, maybe try resetting the project back to before you opened it, removing the MaterialUI folder, replacing it, then opening it in Unity.

~ Declan.

1 Answer

0 votes
answered Jan 10, 2017 by Ian Grant
Hi thanks, it was the same Unity version. Just preparing to migrate the project to 5.5.

I fixed by stepping back through the commits checking the last version with all the references intact then re-did changes between the 'broken' version and the working version. Very odd. I could replicate the issue (it happened again on the 'broken' committed project: game screen went blue then a whole host of references were lost (not only Material UI I think though these were the most noticeable).

I wonder: the MaterialUI components are prefabs?  I did edit a MaterialUI script MaterialRadio to override the 24x24 default. Would all prefabs 'reset' under any circumstances?

Thanks for the response, Ian
commented Jan 25, 2017 by admin (31,720 points)

Hi Ian,

When you use the GameObject->MaterialUI menu to create them, the components are taken from prefabs (You can see how this is done in MaterialUI/Editor/Tools/MaterialUIEditorTools). However, they're only used as a 'template' of sorts and all ties between the prefabs and newly-created objects are removed upon creation.

It sounds like the issue may be due to something interfering with the serialization process, or Unity's .meta files. Is there anything indicating that in the console or the repo commits?

~ Declan.

Welcome to MaterialUI support! Ask us anything :)
...