This package has been deprecated and may no longer be maintained. We recommend looking for an alternative.
YapYap FontAPI
️A simple API to replace the YapYap game Font for the UI and 3DWorld.FontAPI
A simple library to replace the YapYap game Font for the UI and 3DWorld.
Handles UI text (TextMeshProUGUI) and 3D World text (TextMeshPro) automatically.
How to use (For Modders)
- Reference the DLL: Add
Jettcodey.FontAPI.dllas a reference in your C# project. - Add Dependency: Add
[BepInDependency("Jettcodey.FontAPI")]to yourBaseUnityPlugin. - Load & Set: Load your AssetBundle and pass the TMP Font Asset to the API.
Code Example
using BepInEx;
using UnityEngine;
using Jettcodey.FontAPI;
[BepInPlugin("myname.coolfont", "My Cool Font", "1.0.0")]
[BepInDependency("Jettcodey.FontAPI")]
public class MyFontMod : BaseUnityPlugin
{
public static MyFontMod Instance { get; private set; }
internal static new ManualLogSource? Logger { get; private set; }
private Harmony _harmony;
private void Awake()
{
Instance = this;
_Logger = base.Logger;
// 1. Load your AssetBundle
string pluginDir = Path.GetDirectoryName(Info.Location);
string path = Path.Combine(pluginDir, "myfontbundle");
AssetBundle bundle = AssetBundle.LoadFromFile(path);
if (bundle == null)
{
Logger.LogError("Failed to load bundle!");
return;
}
// 2. Register the font
// IMPORTANT: Use the name of the "SDF" Asset, not the .ttf file
FontAPI.LoadAndSet(bundle, "MyCoolFont SDF");
Logger.LogInfo("Font replaced!");
}
}
Creating the AssetBundle
The game cannot load raw .ttf files. You must create a TextMeshPro Font Asset in Unity.
-
Unity Version: Use the same Unity version as the game (for YAPYAP, this is v6000.0.x).
-
Import Font: Drag your
.ttfor.otfinto Unity. -
Create Asset: Right-click the font -> Create -> TextMeshPro -> Font Asset.
-
Settings:
- Character Set: Unicode Range (Hex)
- Atlas Population Mode: Dynamic (Recommended)
- Atlas Render Mode:
SDForSDFAA
-
Build the Assetbundle: Assign the generated SDF Asset to an AssetBundle (e.g., myfontbundle) and build it.
