in V.1.9.1 you can see where I attempted to catch the errors myself but just kept moving the problem.
Debug.LogError("SUPERTEXTMESH Index Length Error");
The first error was here. info was not large enough for i.
Font myFont = info[i].fontData != null ? info[i].fontData.font : font; //use info's font, or default?
//info[i].size *= bestFitMulti;
void RebuildTextInfo()
{
drawText = ParseText(text); //remove parsing junk (<col>, <b>), and fill textinfo again
lineBreaks.Clear(); //index of line break characters, for centering
hyphenedText = string.Copy(drawText);
CalculateLineHeights(); //figure out line heigts for unwrapped equation
//Debug.Log("lines: " + lineHeights.Count);
Vector3 pos = new Vector3(info.Count > 0 ? info[0].indent : 0f,
lineHeights.Count > 0 ? -lineHeights[0] : -size,
0f); //keep track of where to place this text
if (bestFit != BestFitMode.Off)
{
FigureOutUnwrappedLimits(pos);
}
else
{
unwrappedBottomRightTextBounds.x = 1f;
unwrappedBottomRightTextBounds.y = 1f;
}
CalculateBestFitMulti();
//apply this multi to every letter early
for (int i = 0; i < hyphenedText.Length; i++)
{
info[i].size *= bestFitMulti;
}
CalculateLineHeights(); //now with multi applied, redo line heights
pos.x = info.Count > 0 ? info[0].indent : 0f;
pos.y = lineHeights.Count > 0 ? -lineHeights[0] : size;
totalWidth = 0f;
allFonts.Clear();
if (AutoWrap > 0f)
{ //use autowrap?
//TODO see if setting "quality" to be info[i].ch.size has any GC issues, now: 2016-10-26
for (int i = 0, iL = hyphenedText.Length; i < iL; i++)
{ //first, get character info...
if (i < info.Count && i < hyphenedText.Count())
{
Font myFont = info[i].fontData != null ? info[i].fontData.font : font; //use info's font, or default?
//info[i].size *= bestFitMulti;
myFont.RequestCharactersInTexture(hyphenedText[i].ToString(), GetFontSize(myFont, info[i]), info[i].ch.style);
CharacterInfo ch;
if (i < info.Count && i < hyphenedText.Count())
{
if (myFont.GetCharacterInfo(hyphenedText[i], out ch, GetFontSize(myFont, info[i]), info[i].ch.style))
{ //does this character exist?
info[i].ch = ch; //remember character info!
// If the character changed, update the cached sizing values.
info[i].UpdateCachedValuesIfChanged();
// SetTextGenSettings(info[i], i);
}
//else, don't draw anything! this charcter won't have info
//...is how it USED to work! instead, lets draw it in a fallback font:
else
{
myFont = data.defaultFont;
if (myFont.GetCharacterInfo(hyphenedText[i], out ch, GetFontSize(myFont, info[i]), info[i].ch.style))
{
//change the font on this mesh to the default
info[i].fontData = new STMFontData(data.defaultFont);
info[i].ch = ch; //remember character info!
info[i].UpdateCachedValuesIfChanged();
// SetTextGenSettings(info[i], i);
}
}
}
else
{
Debug.LogError("SUPERTEXTMESH Index Length Error");
}
if (!allFonts.Contains(myFont))
{ //if this font is not listed yet
allFonts.Add(myFont);
}
}
else
{
Debug.LogError("SUPERTEXTMESH Index Length Error");
}
}