Hi, the new TextMeshPro support is cool. But I realized when using TMP for dialog text scroll, the Unity rich text tags will be compiled directly without scrolled out (e.g. <color>, <b>, <i>); while the TMP only tags will be partially displayed before the whole tag is scrolled out and compiled (e.g. <link>, <sup>, <sub>). The same applies to SuperTextMesh too. Would there a quick fix in some code so that the scrolling dialog can handle TMP <> tags like the AC [] tags?
I have thought of using SetCustomToken, but it can only be called by [token:ID] which is inconvenient as it is not descriptive, and also I cannot find a way to set custom token that can take parameters.
p.s. I am using Unity 2018.1.4f1 & AC 1.65.0
Comments
I have thought of adding a script that reads the last character of the scrolling dialog text field, then when it reads "<", set the scroll speed to super fast until it reads ">". But this doesn't look very neat. Can you point me to the script that handle the AC [] tags for trying to seek a neater solution?
About the custom token, where should I put the KickStarter.runtimeVariables.SetCustomToken (0, "<custom>"); code? When I put it in the a script that is attached to the Speech Menu canvas, [token:0] does scroll out before turning into <custom> after fully rolled out.
Would you plan to make the "adding custom tags" capability to some external locations? Like, making Speech.cs read a text field or script or a text window in the inspector, so that the custom tags won't be overwritten when AC is updated?
Hello, after updating from 1.65.2 to 1.66.2, I modified Speech.cs again with
private RichTextTag[] richTextTags = new RichTextTag[]
{
#if TextMeshProIsPresent
new RichTextTag ("s"),
new RichTextTag ("u"),
new RichTextTag ("sub"),
new RichTextTag ("sup"),
new RichTextTag ("link="),
#endif
new RichTextTag ("b"),
new RichTextTag ("i"),
new RichTextTag ("size="),
new RichTextTag ("color="),
new RichTextTag ("c="),
new RichTextTag ("w"),
new RichTextTag ("w="),
new RichTextTag ("j"),
new RichTextTag ("j=")
};
But it seems now the tags are also rolled out when the text is rolling.
Sorry, meaning what exactly?
The rich-text tag detection code is being re-written again as part of v1.66.4, but custom tags go in the Dialog component's Inspector on the GameEngine.
I mean the custom rich-text tags will be rolled out partially before it can be compiled. For example, a dialog of {w}Hello{/w}(< in place of { as the forum complies the < tags too) will be rolled out as:
<
<w
H
He
Hel
Hello
Hello<
Hello</
Hello
In v1.65.2 the partial roll-out of custom tags can be avoided using your instructions of modifying the richTextTags. But in v1.66.2 this way seems not working anymore...
[quote]
The rich-text tag detection code is being re-written again as part of v1.66.4, but custom tags go in the Dialog component's Inspector on the GameEngine.
[/quote]
Does it mean this feature will be handled in another way?
Not from the user perspective, no. But if there is an issue here, I'll address it.
Forgetting about modifying Speech.cs, what happens if you insert them into Dialog's Inspector?
Ah it works. Sorry I didn't know the option is now in the GameEngine Dialog component. Thanks.
For the tags in the GameEngine Dialog's Inspector, there are some tags I need without closing tags (e.g. <q=xxx> is compiled but is not). Is it possible to add an option to the tags to choose whether it has closing tags? Or are there even better ways to work around this?
Closing tags are necessary for rich text, since they're used to mark what text is affected. I suppose you could try inserting e.g. <q=xxx>
What is the effect you're trying to actually achieve? You may be better off relying on custom speech tokens - see the Manual's "Speech event tokens" for more.
Hi. I wanna use this textmesh pro tag <sprite="assetName" name="spriteName">, but i can't make it not scroll. Do i have to modify something in Speech.cs? I tried using speech tags, but i don't really understand them. When i insert [token:1] to speech, it just shows as text. I'm using AC 1.68.4
Speech text tokens are used for text-replacement. <sprite="xx"> is a rich-text tag.
Rich-text tags need to be handled carefully when text is scrolling, because the closing tag needs to be added on dynamically when the scroll is midway through it. Custom rich-text tags can be added from the GameEngine object's Dialog component.
Find the Dialog component Inspector, increase the Rich Text Tags field's Size to 5, and set the last one to sprite=. You will have to enter in a closing tag into your speech text for it to work.