Unity Update (5.3.1) causing component errors

Hi Unity Community

I have recently updated my Unity Editor from 5.2.2 (I think) to 5.3.1 and a bunch of script errors occurred as a result. NB: scripts are in uJS.

A reoccurring issue seems to be related to the UI Text component. Previous references such as var buttonText = instButton.GetComponentInChildren(Text); now produce the error BCE0019: 'text' is not a member of 'UnityEngine.Component'.

Have tried to resolve this through casting the reference as var buttonText : Text = instButton.GetComponentInChildren(Text);. However this only changes the error message to:

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.UI.Graphic.OnRebuildRequested () (at /Users/builduser/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Graphic.cs:466)
UnityEngine.UI.GraphicRebuildTracker.OnRebuildRequested () (at /Users/builduser/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/GraphicRebuildTracker.cs:33)
UnityEngine.CanvasRenderer.RequestRefresh () 

The cause of which I am not entirely sure, however have read that this may be related to missing scripts in the package (not sure how this could be related to this issue).

If anyone can enlighten me as to why this may be occurring I would be incredibly grateful.
Many thanks in advance,


Component gets like:

var buttonText = instButton.GetComponentInChildren(Text);

would have always given you problems. GetComponentInChildren returns type Component which doesn’t have a member named “text”, but a “Text” type does. Use explicit types when getting components so you can call the specific class members like buttonText.text = “”;

var buttonText : Text = instButton.GetComponentInChildren.<Text>();

Now when the component is gotten it will either be null or of the first type Text component that it found.

If buttonText is null this is due to GetComponentInChildren finding a Component of type Text. Does “instButton” have a child component of type “Text”?