- Home /
Strange Interaction Between UI, Coroutines, and Content Fitters: Corrections Are Very Welcome
Hey, currently I have a problem when I use an IEnumerator to slice up and add single characters from a provided string into a text field that is visible, giving an auto-scrolling text effect.
What ends up happening for this very specific UI text, is nothing will be displayed. The strange part is that everything else seems to be working, as the text field in the inspector updates and is being continually added to. If I move around the transform of the UI text in question it will update instantly and once I do that the field updates as intended. None of my other text seems to do this, and multiple are going through the same system. The only difference is that this UI text field also has a content size fitter and a scroll rect on the parent to expand the text box according to the amount of text inside and drag it around respectively. So it must have something to do with these but I'm out of ideas on how to fix it. Another odd thing is this specific UI text field loses its default UI material on startup. I'm guessing because it doesn't currently own any text inside at the start? Outside of edit mode, I can see it has both default UI material and layout properties- but unless I "update" the field by moving it manually through the inspector I'll just see the layout properties.
Note that there aren't any issues with canvas order layer or things overlapping it. This only happens when I add text to it using Coroutines and IEnumerators. If I just have the text equal the given string into one big paragraph instantly, the UI text will update as it should. Though I'd rather not have to have this inconsistency with my UI.
Your answer
Follow this Question
Related Questions
UI Text compression on android 1 Answer
Render Debug.Log as UI Text 2 Answers
What's your equivalent of old GUIStyle ? 0 Answers
Canvas is flipping, 2D game 0 Answers