Skip to content

Commit 0190765

Browse files
committed
FIX: word break GUIs are sometimes unreliable
1 parent 92d25be commit 0190765

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Runtime/ThaiTextNurse/ThaiTextNurse.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,18 +352,14 @@ public static void VisualizeInEditor(ThaiTextNurse nurse)
352352
return;
353353

354354
var breakIndices = new List<int>();
355-
var wordLeftCount = nurse.LastWordCount;
356355
for (int i = 0; i < nurse.CharacterInfoLength; i++)
357356
{
357+
//This is needed because CharacterInfos are kind of unreliable on undo
358+
if (i > nurse.outputString.Length)
359+
break;
360+
358361
if (nurse.GetCharacterInfo(i).character == breakCharacter[0])
359-
{
360362
breakIndices.Add(i);
361-
362-
//This is needed because CharacterInfos are kind of unreliable on undo
363-
wordLeftCount--;
364-
if (wordLeftCount <= 1)
365-
break;
366-
}
367363
}
368364

369365
var oldColor = Handles.color;

0 commit comments

Comments
 (0)