Unity Engine

A guide to modifying font sizes in Unity games using the BepInEx framework and XUAT plugin

This method might not work for some games

Step 1: Enable Console

  • Open the file "GAME_DIR\BepInEx\config\BepInEx.cfg"

  • In the [Logging.Console] section, change "Enabled = false" to "Enabled = true"

GAME_DIR\BepInEx\config\BepInEx.cfg
[Logging.Console]

## Enables showing a console for log output.
# Setting type: Boolean
# Default value: false
Enabled = true

Step 2: Enable Text Path Logging

  • Open the file "GAME_DIR\BepInEx\config\AutoTranslatorConfig.ini"

  • In the [Behaviour] section, change "EnableTextPathLogging=False" to "EnableTextPathLogging=True"

GAME_DIR\BepInEx\config\AutoTranslatorConfig.ini
[Behaviour]
EnableTextPathLogging=True

Step 3: Launch the game and find the Text Path in the Console

If configured correctly, a console window will appear, showing the Game Text and Text Path

[Info   :XUnity.AutoTranslator] Setting text on '???' to '???' # <-- Game Text
[Info   :XUnity.AutoTranslator] Path : ??? # <-- Text Path
[Info   :XUnity.AutoTranslator] Level: ???

Step 4: Creating a Resizer File

Create a file named "resizer.txt" into the folder "GAME_DIR\BepInEx\Translation\en\Text\". For example: "GAME_DIR\BepInEx\Translation\en\Text\resizer.txt"

You can create more than one of these files. Each file must be a .txt file with the name ending in "resizer". Example: mainmenu_resizer.txt, dialogue.resizer.txt, _resizer.txt

Syntax:

TextPath=Command

where available commands are:

  • Commands that change the font size to a static size

    • ChangeFontSizeByPercentage(double percentage): Where the percentage is the percentage of the original font size to reduce it to.

    • ChangeFontSize(int size): Where the size if the new size of the font

    • IgnoreFontSize(): This can be used to reset font resize behavior that was set on a very 'non-specific' path.

For more information, visit: https://github.com/bbepis/XUnity.AutoTranslator#ui-font-resizing


Example of the font resizer syntax in the Quickie Game:

Console
[Info   :XUnity.AutoTranslator] Setting text on 'TMPro.TextMeshProUGUI' to 'Lorem Ipsum...'
[Info   :XUnity.AutoTranslator] Path : /UIManager/ui_conversation/limiter/panel_dialogue/normal/txtmeshDialogueNormal
[Info   :XUnity.AutoTranslator] Level: -1
[Info   :XUnity.AutoTranslator] Setting text on 'UnityEngine.UI.Text' to 'It is a long...'
[Info   :XUnity.AutoTranslator] Path : /UIManager/ui_conversation/limiter/choices/panel_choices/ui_conversation_option(Clone)/text
[Info   :XUnity.AutoTranslator] Level: -1
[Info   :XUnity.AutoTranslator] Setting text on 'UnityEngine.UI.Text' to 'Contrary to popular...'
[Info   :XUnity.AutoTranslator] Path : /UIManager/ui_conversation/limiter/choices/panel_choices/ui_conversation_option(Clone)/text
[Info   :XUnity.AutoTranslator] Level: -1
resizer.txt
/UIManager/ui_conversation/limiter/panel_dialogue/normal/txtmeshDialogueNormal=ChangeFontSizeByPercentage(0.75)
/UIManager/ui_conversation/limiter/choices/panel_choices/ui_conversation_option(Clone)/text=ChangeFontSizeByPercentage(0.75)

ChangeFontSizeByPercentage(0.75)

  • 0.5 = 50%

  • 1 = 100%

  • 1.5 = 150%

mainmenu_resizer.txt
/mainmenu/limiter/content/bg/info/butons/btnNewGame/Text=ChangeFontSize(16)
/mainmenu/limiter/content/bg/info/butons/btnLoadGame/Text=ChangeFontSize(16)
/mainmenu/limiter/content/bg/info/butons/btnOptions/Text=ChangeFontSize(16)
/mainmenu/limiter/content/bg/info/butons/btnCredits/Text=ChangeFontSize(16)
/mainmenu/limiter/content/bg/info/butons/btnQuit/Text=ChangeFontSize(16)

# Or for all groups "/mainmenu/limiter/content/bg/info/butons"

/mainmenu/limiter/content/bg/info/butons=ChangeFontSize(16)

Last updated