prime31/UIToolkit — Issue #75: Text - missing reference after clear
Author: capitaljmedia
Created: 2012-02-20 20:30:50+00:00
State: open

Once a text instance has clear() called on it, the text can still be changed but it can no longer be animated. I tried this in the demo scene to make sure it wasn't something in my game code. If you try to enter new text to one of the text instances in the IEnumerator modifyTextInstances() method after the text instance is cleared and then try to animate it with a PositionTo then this error comes up:

MissingReferenceException: The object of type 'Transform' 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.Transform.TransformPoint (Vector3 position)
UISprite.updateTransform () (at Assets/Plugins/UIToolkit/BaseElements/UISprite.cs:311)
UISprite.transformChanged () (at Assets/Plugins/UIToolkit/BaseElements/UISprite.cs:220)

The reason I was trying this out is because changing text in this latest UIToolKit build seems to not remove the pervious text in the text instance. So if I do this:

text1.text = "long test";
text1.text = "short";

the result is:

shorttest

or a jumble of both texts in the same space.