Page 1 of 2
Change Subtitle Font In the Middle of the String
Posted: Tue Mar 16, 2021 11:30 pm
by boz
Is it possible to change the subtitle text with tags in the middle with code?
Maybe have to turn the whole thing into a TextMeshPro dealio?
Thanks for any advice
Re: Change Subtitle Font In the Middle of the String
Posted: Wed Mar 17, 2021 9:10 am
by Tony Li
Hi,
Yes, if you
switch to TextMesh Pro, you can use the
<font> tag to change fonts in the middle of a string.
Re: Change Subtitle Font In the Middle of the String
Posted: Wed Mar 31, 2021 4:23 am
by boz
Thank you for that input, I was able to get it implemented with those instructions.
A strange problem arrived after I started changing some of the fonts - it seems to stop scrolling with the next text at random. I noticed some other positioning problems that came in after swapping to Text Mesh Pro, so that might be related.
But I'm wondering if this instantly clicks as an "Oh, just check X" or not.
What might be causing the font change to make the subtitle stop scrolling automatically? It seems to stay one message behind. (I am using the TextMesh Pro Typewriter Effect)
Re: Change Subtitle Font In the Middle of the String
Posted: Wed Mar 31, 2021 10:04 am
by Tony Li
Hi,
Are there any errors or warnings in the Console window?
Nothing in the typewriter effect should cause it to stop or to show subtitles one line behind.
Would it be possible for you to send a reproduction project to tony (at) pixelcrushers.com? You can zip up the Assets, Packages, and ProjectSettings folders. Please include the steps to follow to reproduce the issue.
Re: Change Subtitle Font In the Middle of the String
Posted: Thu Apr 01, 2021 12:24 am
by boz
Avoiding the time it takes to package everything up and send it over (for now), I seem to have narrowed it down to ANY sort of formatting tag, either directly in the Dialogue Text field or added by script makes the TextMesh Pro Typewriter Effect stop working (lines just pop in) and after a couple lines it makes the messages pop in one message behind. (maybe it gets stuck and thinks I'm hitting skip?)
Any formatting I remove makes it work until the next formatting it hits.
Thoughts? Or do you just want to see it?
Re: Change Subtitle Font In the Middle of the String
Posted: Thu Apr 01, 2021 9:41 am
by Tony Li
Hi,
Are there any errors or warnings in the Console window?
I may need to see a reproduction project. As a test, I assigned a TextMesh Pro dialogue UI to DemoScene1 and set Private Hart's first line of dialogue to:
We need to intercept the <color=red><b>launch codes</b></color> before the enemy launches their weapon at our home world.
The typewriter effect worked correctly.
Re: Change Subtitle Font In the Middle of the String
Posted: Thu Apr 01, 2021 6:08 pm
by boz
No errors or warnings.
I'll set something up.
Re: Change Subtitle Font In the Middle of the String
Posted: Thu Apr 01, 2021 8:15 pm
by Tony Li
Thanks! You can send a download link to tony (at) pixelcrushers.com.
Re: Change Subtitle Font In the Middle of the String
Posted: Thu Apr 01, 2021 8:44 pm
by boz
Okay, when I
1) Use the DemoScene1
2) Switch to the WRPG template.
3) Change the subtitle and typewriter to TextMeshPro
The autoscroll doesn't work with the Accumulate Text until I set up the OnCharacter() to set ScrollRect.verticalNormalizedPosition to 0 on the Scroll Rect.
I can use <color=red><b>launch codes</b></color> and it works just fine.
However, the moment I use:
<font=LiberationSans SDF>asdf</font> (which I think comes stock with TMP pro) or any other TMP Font Asset in the Dialogue Text, it displays the text in the font correctly, but after that line, the typewriter and autoscroll stops working.
Am I setting this up wrong?
Re: Change Subtitle Font In the Middle of the String
Posted: Thu Apr 01, 2021 9:03 pm
by Tony Li
LiberationSans is the default font, so I imported TMP's Extras (Window > TextMesh Pro > Import TMP Examples and Extras) and used Bangers instead:
Code: Select all
We need to <font="Bangers SDF">intercept</font> the <color=red><b>launch codes</b></color> before the enemy launches their weapon at our home world.
It works just fine. I'm testing in Unity 2020.1 with Dialogue System version 2.2.15.
If you're seeing something different, would you please zip up your project's Assets, Package, and ProjectSettings folders, and send them to tony (at) pixelcrushers.com?