Warning: It is recommended to backup the config file before making changes.
1. Configuration Preparation
To change the font in Unity, you need to know the “label address location”.
To find out the label address location, you need to enable “Enable Text Path Logging”.
If you are using Translator++:
Click on XUnity>Options
In the options window, turn on “Enable Text Path Logging”
Alternatively, you can change it from the .ini file located atBepInEx\config\AutoTranslatorConfig.ini
In the behavior section, change EnableTextPathLogging=False
to EnableTextPathLogging=True
Activate console logging (optional)
To make it easier to search for label addresses, you can also enable the console in the BepInEx framework.
Or you can change it from the .cfg file located atBepInEx\config\BepInEx.cfg
In the Logging.Console section, change Enabled = false
to Enabled = true
2. Finding the Label Address
Run the game
And when the game loads the text that you want to resize, pay attention to the displayed text and search for it in the console,
Copy the text in the path: section. (highlighted in the picture)
Or if you haven’t enabled the console, you can search for it in BepInEx\LogOutput.log
2. Syntax
The syntax for changing the font size should be in a .txt file with a resizer suffix in the file name.
Examples:
12.resizer.txt
_resizer.txt
event.resizer.txt
FileResizer.txt
resizer.txt
The syntax is written as follows:
Path=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 fontIgnoreFontSize()
: This can be used to reset font resize behavior that was set on a very ‘non-specific’ path.
- Commands that control auto-resizing:
AutoResize(bool enabled, minSize, maxSize)
: Where enabled control if auto-resize behaviour should be enabled. The two last parameters are optional.- minSize, maxSize possible values: [keep, none, any number]
- Commands that control the line spacing (UGUI only):
UGUI_ChangeLineSpacingByPercentage(float percentage)
UGUI_ChangeLineSpacing(float lineSpacing)
- Commands that control horizontal overflow (UGUI only):
UGUI_HorizontalOverflow(string mode)
– possible values: [wrap, overflow]
- Commands that control vertical overflow (UGUI only):
UGUI_VerticalOverflow(string mode)
– possible values: [truncate, overflow]
- Commands to control overflow (TMP only):
TMP_Overflow(string mode)
– possible values
- Commands to control text alignment (TMP only):
TMP_Alignment(string mode)
– possible values
Example of font resizer syntax is as follows:
In the game Witch’s Apprentice Uniko:
/TitleManager/TitleCanvas/SettingPanel/Layout_TopButtons/TopButton_Operation/Text=ChangeFontSizeByPercentage(0.6)
/TitleManager/TitleCanvas/SettingPanel/Main/ExplainOperationPanel/Main/Title=ChangeFontSize(15)
In the game Princess Connect Redive by PriconneRe:TL :
/_Game(Clone)/UI Root/FrontArea/IgnoreBlurLayer/DialogArea/DialogQuestResultLose(Clone)/Main/PartsLaterParent/PartsQuestResultLater(Clone)/LaterButtons/BottomParts/ButtonAnimator/Button/TicketRematchButton/Label=ChangeFontSize(20)
/_Game(Clone)/UI Root/FrontArea/IgnoreBlurLayer/DialogArea/DialogCommonFullSize(Clone)/Main/PartsParent/PartsDialogEquipEnchant(Clone)/Right/Right_Normal/transactionLawsButtonParent/PartsDialogCommonItem_TRANSACTION_LAWS_BUTTON/Button/Text=ChangeFontSizeByPercentage(0.8)
The example above shows Unity Mono 64-bit and 32-bit using BepInEx as the framework. If you have followed the steps correctly but the font size does not change, it is possible that it is not compatible.
It is highly discouraged to redistribute with EnableTextPathLogging and Logging. The console is turned on in the configuration. Make sure both configurations are turned off when you redistribute.
For more information, you can visit: https://github.com/bbepis/XUnity.AutoTranslator#ui-font-resizing