Font Bundles - TheMysticSword/Localyssation GitHub Wiki
A Font bundle is a Unity asset bundle that contains additional fonts that aren't present in the game to be used in custom translations.
Creating a font bundle
Part 1: The Unity Part
- Download and install Unity of the same version that ATLYSS uses. At the time of writing this guide, version 2021.3.16f1 is being used.
- Open Unity and create a new project, using the 3D template
- At the top of the editor, go to Window > Package Manager
- Install Asset Bundle Browser package:
- Click the + button in the top-left of the newly opened window
- Select "Add package from git URL..."
- Paste https://github.com/Unity-Technologies/AssetBundles-Browser.git
- Click Add
- Drag-and-drop your font files into the Assets folder in Unity
- Select all your font files in Unity, then find "AssetBundle" in the bottom-right part of the editor. Click it and set a unique asset bundle name. This will be the name of your font bundle.
- On each font file, right-click and select Create > TextMeshPro > Font Asset
- Set the AssetBundle name to your font bundle name for each of the TextMeshPro font assets that you've just created in the previous step
- At the top of the editor, go to Window > AssetBundle Browser
- Go to the Build tab, then click the Build button
- Navigate to
<your Unity project folder>/AssetBundles/StandaloneWindows
. If you can see a file with the same name as your asset bundle name you've set in step 6, you've done everything correctly! This file is your AssetBundle.
Part 2: Setting up the file structure
(Note: you can check out the extraFontBundle
folder inside Localyssation's mod folder to see what an existing font bundle looks like)
- Inside your custom language's folder, create a new file called
localyssationFontBundle.json
- Open the file and paste the following content:
{
"bundleName": "",
"fontInfos": [
{
"name": "",
"sizeMultiplier": 1.0
},
{
"name": "",
"sizeMultiplier": 1.0
}
]
}
- Set
bundleName
to your bundle's file name - In
fontInfos
, changename
to the name of the font file in your Unity project (without the file extension). Add as many font infos as you need (e.g. if your Unity project has 3 fonts, you will need 3 font infos). - Copy the AssetBundle you've made in the previous part and paste it into your language's folder
Part 3: Using the newly added fonts in your language
- In your
localyssationLanguage.json
, changebundleName
of thefontReplacement
fields to your bundle name, andfontName
fields to the fonts that you want to use. - Open the game. If fonts disappear or go out of bounds, go back to your
localyssationFontBundle.json
file, reduce thesizeMultiplier
of the faulty fonts, then restart the game