Unity 2018.4.26f1 HyperText preferences broken and truncation issues

99 views
Skip to first unread message

ja...@crytivo.com

unread,
Aug 24, 2020, 4:17:58 PM8/24/20
to Developer Support
I've also submitted a bug report email about this, but for sake of other users:

It appears that in 26f1, text entered in hypertext components will always cut the final letter. In addition, the Candlelight preferences tab is empty and throws errors.

Here are two sample projects, one working in 24f1, and one broken in 26f1.

Following is a screenshot of the empty settings. If there is no plan of continuing support I'll see if I can find a fix myself, or move on to a new plugin and try to give an update here.

Jacob Freeland

unread,
Aug 25, 2020, 5:02:29 PM8/25/20
to Developer Support, ja...@crytivo.com

It looks like in this update and on 2019, meshes for UI Text no longer give white spaces their own quad unless the vertical text overflow mode is set to truncate and text is overflowing.

I scrapped together a solution for a couple of the issues with this update, but it looks like inline images, shadows, and probably several more features I didn't note are still broken. Here's my solution for the hyperlink offsets and final letter truncation:


HyperText.cs:
In OnPopulateMesh() comment out:

#if !IS_VBO_UI_VERTEX
if (m_UIVertices.Count > 0)
{
m_UIVertices.RemoveRange(m_UIVertices.Count - 4, 4);
}
#endif
Add to the file:
        protected override void OnRectTransformDimensionsChange()
        {
            base.OnRectTransformDimensionsChange();
            UpdateProcessorMeshMode(true);
        }
        private void UpdateProcessorMeshMode(bool forceUpdate)
        {
            // If there's vertical truncation then the mesh format changes and link locations need to be recalculated
            TextProcessor.QuadsForSpaces = false;
            if (cachedTextGenerator.GetPreferredHeight(m_TextGeneratorInput, GetGenerationSettings(this.rectTransform.rect.size)) > this.rectTransform.rect.height)
            {
                if (verticalOverflow == VerticalWrapMode.Truncate)
                    TextProcessor.QuadsForSpaces = true;
            }
            if (forceUpdate)
                TextProcessor.ProcessInputText(true);
        }
In GetLinks add:
UpdateProcessorMeshMode(false); before the GetLinks call


HyperTextProcessor.cs:
Add:
public bool QuadsForSpaces = false;

Replace the first few lines of ProcessInputText with:
        public void ProcessInputText(bool force = false)
        {
            // early out if already up to date
            if (!force && !m_IsDirty)
            {
                return;
            }
            
In ProcessInputText within the while (s_PostprocessedLinkTagRegex.IsMatch(textCache)) at the end, add:
        if (!QuadsForSpaces && m_Links.Count != 0) 
        {
            Link currentLink = m_Links[m_Links.Count - 1];
            int preceedingSpaces = textCache.Substring(0, currentLink.CharacterIndices.StartIndex).Count(c=>char.IsWhiteSpace(c));
            int internalSpaces = textCache.Substring(currentLink.CharacterIndices.StartIndex, currentLink.CharacterIndices.EndIndex - currentLink.CharacterIndices.StartIndex).Count(c=>char.IsWhiteSpace(c));

            currentLink.CharacterIndices.StartIndex -= preceedingSpaces;
            currentLink.CharacterIndices.EndIndex -= (preceedingSpaces + internalSpaces);
        }



I'll probably abandon this plugin shortly.

aki koshima

unread,
Sep 23, 2020, 11:08:12 AM9/23/20
to Developer Support, Jacob Freeland
have you fix the issue, i have met the same problem

Jacob Freeland

unread,
Sep 24, 2020, 12:09:46 PM9/24/20
to Developer Support, acgl...@gmail.com, Jacob Freeland

I ended up needing to migrate our whole project to TextMeshPro unfortunately. Took some time.
Reply all
Reply to author
Forward
0 new messages