- Home /
UI text visual glitching
Hi guys,
So I've spent all day attempting to set up a series of text string which would fade in and out on the screen inside an IEnumerator, I eventually gave up on the fading in and out for now, as for some reason it wouldn't fade completely, despite other text elements in the HUD fading out just find using the same method of the text.crossfadealpha(0.0f, 5, false).
So I eventually ended up with this simplified code:
IEnumerator QuoteSeries()
{
quoteBox.enabled = true;
quoteBox.text = "text goes here";
yield return new WaitForSeconds(15);
quoteBox.text = "text goes here";
yield return new WaitForSeconds(15);
quoteBox.text = "text goes here";
yield return new WaitForSeconds(15);
I've removed the somewhat extensive strings of text I was using, but the basic idea is that after 15 seconds the text value is changed to the next line of text I want to display which seems solid in theory. Although in practice I get a lot of strange visual glitches. The text seems to be rapidly switching in between the current string it's attempting to display, and the previous one. Although it does it quite quickly so I can't be sure which strings it's attempting to display.
I had some results with moving it to a different script, but it's still not working as intended. Now it just displays the wrong string. I should also mention that the strings are quite long, I'd say 200 characters or so. There's about 11 different times it changes as well. Am I just pushing the UI too far?
Answer by AMU4u · Mar 10, 2017 at 04:53 AM
Put a Debug.Log statement inside the coroutine and see if the function is firing properly.
If it is, do a build and see if the problem persists. It probably won't. UI is glitchy in editor with unity 5.