You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My character animations are getting as far as the character I have in my text.
I'm even skipping the sprite character animation setup.
for (int i = 0; i < tweener.CharacterCount; i++)
{
TMP_CharacterInfo charInfo = textInfo.characterInfo[i];
if (charInfo.elementType == TMP_TextElementType.Sprite) {
Debug.LogWarning($"TMP_TextElementType.Sprite character");
continue;
}
// Character animation setup comes next...
}
I've found that if I edit the Text live in the Editor and delete the Sprite, the animations for all the characters suddenly start working.
Any tips?
Update 1
In fact, it looks like that is the case with all Rich Text Tags in my TextMeshPro label...
Update 2
I've discovered that in CharTweener::UpdateCharPositions()
There is a check which is skipping characters after a Sprite character...
for (var i = proxyTransformList.Count - 1; i >= 0; i--)
{
// ...
if (proxy.CharIndex >= characterCount)
continue;
// ...
}
Looks like proxy.CharIndex is referencing the index of characters BEFORE Rich Text Tags are passed and characterCount uses the count AFTER Rich Text Tags are passed.
The text was updated successfully, but these errors were encountered:
Alright I figured out a solution that got it working with Sprites present.
I'm too lazy to make a pull request, so if anyone wants to make the change or find the solution, here it is:
In CharTweener.cs, modify AssignCharInfo(TMP_CharacterInfo charInfo) to the following
public void AssignCharInfo(TMP_CharacterInfo charInfo, int parsedCharIndex)
{
// charIndex = charInfo.index;
charIndex = parsedCharIndex;
// ...
}
Then, anytime AssignCharInfo() is called, pass the non-raw character index.
That means changing the two calls in UpdateStartPositions() to...
Sprites and all following characters worked for me after that.
I assume this also fixes any labels that contain Rich Text.
cellininicholas
changed the title
Sprite in TextMesh label is stopping character animations
Sprite and/or Rich Text tags in TextMesh label is stopping character animations
Jun 5, 2024
My character animations are getting as far as the character I have in my text.
I'm even skipping the sprite character animation setup.
I've found that if I edit the Text live in the Editor and delete the Sprite, the animations for all the characters suddenly start working.
Any tips?
Update 1
In fact, it looks like that is the case with all Rich Text Tags in my TextMeshPro label...
Update 2
I've discovered that in
CharTweener::UpdateCharPositions()
There is a check which is skipping characters after a Sprite character...
Looks like
proxy.CharIndex
is referencing the index of characters BEFORE Rich Text Tags are passed and characterCount uses the count AFTER Rich Text Tags are passed.The text was updated successfully, but these errors were encountered: