- Home /
uGUI Text not updated until RectTransform has been altered
Right now I'm building a custom Inspector for a derived class of the UI.Text component. I'm having trouble changing the text in OnDisable and see it updated in the editor.
I've tried calling the following afterwards to no avail:
SetLayoutDirty()
SetVerticesDirty()
SetAllDirty()
Canvas.ForceUpdateCanvases()
The only way the text actually updates itself is by moving or scaling its RectTransform in the scene. Since there's no access to the RectTransform component code on bitbucket, i can't look into what it's doing different.
How do I get to Update the component programmatically in OnDisable of my custom inspector?
Answer by hexagonius · Nov 04, 2016 at 12:06 PM
I anyone wants to know:
The solution was to NOT change the target text variable itself, but to change the serializedProperty of it. This way, the text updated as expected no matter where it was changed.
Your answer
Follow this Question
Related Questions
Text Not updating 1 Answer
Text component changes the text but doesn't remove the previous version. 0 Answers
Multiple gui instantiation issues 0 Answers
Text UI not updating 2 Answers