Menu Title Font

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Menu Title Font

Post by nathanj »

Hey Tony.
Edit: Just installed the TextMeshPro and it seems to have solved my issue.

Please ignore below.

I'm trying to change the font of the "Menu" header from the Feature Demo component. All of the button's fonts are changed from the GUI Skin but the settings are not applied to:

void OnGUI() {
if (isMenuOpen) {
if (guiSkin != null)
{
GUI.skin = guiSkin;
}
windowRect = GUI.Window(0, windowRect, WindowFunction, "Menu");
}
}

Any suggestions on how to pass the GUistyle through to the windowRect text?

Nathan
User avatar
Tony Li
Posts: 22061
Joined: Thu Jul 18, 2013 1:27 pm

Re: Menu Title Font

Post by Tony Li »

Good choice. TextMesh Pro (or at least Unity UI, with or without the Menu Framework on the Dialogue System Extras page) is a good way to go.

For anyone who might still be using the FeatureDemo script, it uses GUI Skins, which are part of the legacy GUI system, aka immediate mode or OnGUI. To customize its appearance, you need to make a new GUISkin asset or copy one of the existing ones. Then customize the styles in it -- assign different fonts, set colors, etc.
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: Menu Title Font

Post by nathanj »

Hey Tony

I noticed that the Text Mesh Pro Canvas' Quest Log Window uses the default Unity Text component.

If I were to modify this I assume the only changes the code would require would be replacing Text with TextMeshPro and then replacing the Text components in the canvas with TextMeshPro ones. Is this correct?
User avatar
Tony Li
Posts: 22061
Joined: Thu Jul 18, 2013 1:27 pm

Re: Menu Title Font

Post by Tony Li »

There's already a TextMeshProQuestLogWindow script. I just noticed that the TextMesh Pro Support package's example scene doesn't include an example. I'll update the scene in the next release.

But, to make a long story short, you don't need to modify any scripts. Just use TextMeshProQuestLogWindow.

If you want to keep the same GameObject structure as the example scene's quest log window, rather than building your own quest log window, try these steps:

1. Inspect SF Unity UI Quest Log Window.

2. In the Inspector view, click the three-bar menu in the upper right, and switch from Normal to Debug mode.

3. Drag Dialogue System / Third Party Support / TextMesh Pro / Scripts / Quest Log Window / TextMeshProQuestLogWindow.cs into the UnityUIQuestLogWindow component's Script field.

4. Do the same for Quest Log Window Main Panel > Vertical Group > Main Content Horizontal Group > Scroll Area > Scroll Rect > Scroll Content > Quest Template. Replace UnityUIQuestTemplate's script with TextMeshProQuestTemplate.cs.

5. Change the Inspector view back to Normal mode.

6. Go through each child GameObject. Remove the Text element, and add a Text Mesh Pro UGUI component in its place.

7. Assign the new Text Mesh Pro UGUI components to the Text Mesh Pro Quest Template and Text Mesh Pro Quest Log Window components.
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: Menu Title Font

Post by nathanj »

Wow, thanks for another lesson in efficiency.

I'll get to this tomorrow.

Thank you!
Post Reply