Multi-Language Support with Fonts in Unity 2019
Font Limitation: As of 06/10/2024, you cannot dynamically change fonts within Udon scripts in Unity 2019 or Unity 2022. Therefore, you need to set up font switching manually.
Our prefab, Hash Studios Translate, allows you to manage translations and font assignments effectively. For more information, refer to Hash Studios Translate.
Supporting multiple languages in Unity involves ensuring that the chosen fonts can display the necessary characters for each language. This guide will walk you through the process of implementing multi-language support with fonts in Unity 2019.
Unity Text and Fonts
Unity Text components and TextMesh Pro (TMP) components are used to display text in Unity. For multi-language support, it’s crucial to choose fonts that cover the full range of characters required for each language.
Key Points about Unity Text and Fonts:
- Text Components: Standard text components used in Unity.
- TextMesh Pro: Advanced text components providing better text rendering and font asset management.
- Fonts: Ensure that your fonts include characters for all supported languages.
For more detailed information on Unity Text and TextMesh Pro, refer to the Unity TextMesh Pro Documentation.
Step-by-Step Guide: Implementing Multi-Language Support
1. Install TextMesh Pro (TMP)
- Open your Unity project.
- Go to
Window
>Package Manager
. - Search for
TextMesh Pro
and install it if it's not already installed.
2. Choose Appropriate Fonts
For a text to support multiple languages, it needs a specific font that includes characters for those languages. We provide a TMP NotoSans font that supports many languages like Japanese, Chinese (Simplified & Traditional), and Greek characters. This font is labeled as NotoSans-Combined
in the Hash Studios Translate folder.
3. Import Fonts into Unity
- Download the required font files.
- Drag and drop the font files into your Unity project's
Assets
folder.
4. Create Font Assets with TextMesh Pro
- In the Project window, select the font you imported.
- Right-click on the font and select
Create
>TextMeshPro
>Font Asset
. - This will create a new TMP font asset that can be used with TextMesh Pro components.
5. Set Up Text Components
- Replace all standard
Text
components withTextMeshPro - Text
components. - Assign the created TMP font assets to these
TextMeshPro
components.- Select the
TextMeshPro
component in the Inspector. - Under
Font Asset
, assign the appropriate TMP font asset.
- Select the
Best Practices
- Font Selection: Choose fonts that cover the widest range of characters for the languages you need.
- TextMesh Pro: Use TextMesh Pro for better text rendering and font asset management.
- Localization Management: Use a centralized script or manager to handle language switching and text updates.
- Testing: Thoroughly test your project with different languages to ensure that all characters display correctly.
By following these steps and best practices, you can successfully implement multi-language support with fonts in Unity 2019, providing an inclusive and accessible experience for your users.
For more detailed information and resources, refer to the Unity TextMesh Pro Documentation.