Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs

holdingjason@gmail.com

4
Posts
3
Topics
A member registered Apr 23, 2018

Recent community posts

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


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.

v1.9.1

Want to confirm this has been fixed.  Repro on this is very hard and cannot repro it consistently so figured I would check if it was already known and fixed (appears after 1.9.1 there was some fixes related to this in v.1.10 but not sure.  This would be a very bad bug to slip through the cracks, especially since it appears to be a timing issue and having text longer then the text container.

  • Fixed array lengths not matching up under specific circumstances.

The error occurred in RebuildTextInfo() at this line.  i was larger the info array.

       Font myFont = info[i].fontData != null ? info[i].fontData.font : font; //use info's font, or default?

Thanks.

IndexOutOfRangeException: Index was outside the bounds of the array. SuperTextMesh.RebuildTextInfo () (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:2622) SuperTextMesh.Rebuild (System.Single startTime, System.Boolean readAutomatically, System.Boolean executeEvents) (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:1349) SuperTextMesh.Rebuild (System.Single startTime, System.Boolean readAutomatically) (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:1327) SuperTextMesh.Rebuild () (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:1317) SuperTextMesh.set_text (System.String value) (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:681) 

(1 edit)

I would recommend adding the following additional check here to fix these occasional errors.   (textMesh??false)

I get this sometimes when I need to disable my converse bubble between clicks when doing actions say giving characters things and I want to temp hide the UI and then bring it back.  Granted I should be able to track down the correct timing of this but I know adding this additional check just fixes the issue 100% which is safer.

void SetMesh(float timeValue, bool undrawingMesh){ //0 == start mesh, < 0 == end mesh, > 0 == midway mesh
if( textMesh == null || (textMesh??false))

(1 edit)

Getting two different results of positional layout of text for the following;

What a pretty <c=C47015FF> blue shell</c>

What a pretty blue shell

The 1st text is to low is not properly centered in the text box.


The 2nd one works fine.  Centers correctly within the text box. 

 Vertical limit set to 100, Auto Wrap to 245, anchor Middle Center and Alignment Center.  Best fit off.

Thanks