Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Thanks.  Yep upgrading to latest and seeing if it shows up again.  

The repro is tough like you said.  Appears to be related to text that would extend beyond the setup limits of the control AND clicking through ie triggering a full ShowTextAll while its reading in the text.  It appears to be timing based ie it happens, my guess when the text is being rendered out beyond the limits and you try and do a ShowTextAll and immediately set the text to the next statement.  Like you said something in the order of that must be resetting the array vars.  My guess its doing something like setting the next text and array length to the next statement which is shorter then the previous text but rebuild of the previous text is still taking place or gets triggered again.   If I can come up with a hard repro I will pass it along but like I said so far little luck but used to be able to get it 1 out of maybe 5 times etc.

Can you send me the debug log again? I don't know where the error is happening anymore.

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");
                }
            }


Actually, I can't see it because in the latest version, when I hit ctrl+f for that line, it's commented out! So if the error is still happening in the latest version, it must be happening somewhere else. Please update to the latest version and if the error pops up, please send me the error Unity throws, and I'll be able to track it down at it's source.