I've been working on a coroutine that splits text into a list of words, taking a break at every 500-ish characters parsed. See here:
// charsToParsePerFrame = 500
// other code
while (textToParse.Length > 0) {
bool timeToTakeABreak = parseCounter >= charsToParsePerFrame;
if (timeToTakeABreak)
{
yield return null;
parseCounter = 0;
}
// other code
Using the debugger, I saw that as soon as the yield return null is executed, the loop ends, going to the code after the loop. This is a problem, because with the text I supplied it to parse, it leaves a good chunk of it unparsed :/
What is going on? Yield return statements are supposed to pause the execution of code, never break any loops. In a text-showing coroutine I wrote, the yield return statements didn't end the loops they were in (as expected), so I don't see what's different, here.
If it helps any, I'm using Unity 5.6.2f1.
↧