# How to Change Font Size in Unity?

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

{% hint style="info" %}
This method might not work for some games
{% endhint %}

### Step 1: Enable Console

* Open the file `"GAME_DIR\BepInEx\config\BepInEx.cfg"`
* In the \[Logging.Console] section, change "Enabled = false" to "Enabled = true"

{% code title="GAME\_DIR\BepInEx\config\BepInEx.cfg" overflow="wrap" %}

```ini
[Logging.Console]

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

{% endcode %}

### 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"

{% code title="GAME\_DIR\BepInEx\config\AutoTranslatorConfig.ini" overflow="wrap" %}

```ini
[Behaviour]
EnableTextPathLogging=True
```

{% endcode %}

### 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

{% code overflow="wrap" %}

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

{% endcode %}

### 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"

{% hint style="info" %}
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
{% endhint %}

#### **Syntax:**

```ini
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:

<figure><img src="/files/MM2HrblKYSejWvlaXBwU" alt=""><figcaption></figcaption></figure>

{% code title="Console" %}

```powershell
[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
```

{% endcode %}

{% code title="resizer.txt" %}

```ini
/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)
```

{% endcode %}

{% hint style="info" %}
ChangeFontSizeByPercentage(0.75)

* 0.5 = 50%
* 1 = 100%
* 1.5 = 150%
  {% endhint %}

{% code title="mainmenu\_resizer.txt" %}

```ini
/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)
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.vntranslator.com/user-guide/xuat-xunity-autotranslator/how-to-change-font-size-in-unity.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
