-
-
Notifications
You must be signed in to change notification settings - Fork 2
Text
Tom_XV edited this page Sep 23, 2026
·
3 revisions
English | 日本語
The Text library is DragNWash.ModFramework.Text.dll, in the namespace DragNWash.ModFramework.Text. It lets mods see and replace every TextMeshPro text before the game shows it. Several mods can rewrite text, and they run one after another, in order.
[BepInDependency(GameText.Guid, BepInDependency.DependencyFlags.HardDependency)]private IDisposable _rewriter;
private void Awake()
{
_rewriter = GameText.AddRewriter(MyMod.Guid, context =>
{
if (context.Text == "New Game")
{
context.Text = "Start Washing";
}
});
}
private void OnDestroy() => _rewriter?.Dispose();- A rewriter is called for every text the game sets, so keep it cheap. A dictionary lookup is fine, a regex over every string isn't.
-
order(default 0) sets the run order, lowest first. Later rewriters see the earlier changes incontext.Text, butcontext.Sourceis always what the game set. - If your rewriter throws, the exception is logged with your GUID and the text is left as it was.
| Property | Meaning |
|---|---|
TMP_Text Component |
The component the text goes into |
string Source |
The text the game set, before any rewriter |
string Text |
The text that will be shown; set it to change it |
bool FromPrefab |
True for text that was in a prefab and never set by code (menus, labels) |
bool IsRefresh |
True when the text is re-applied by RefreshAll
|
When something your rewriter depends on changes (the player picks another language, a setting flips), call:
GameText.RefreshAll(); // main thread onlyIt runs every rewriter again on every text on screen, starting from the text the game set.
| Member | What it does |
|---|---|
const string Guid |
"com.tomxv.dragnwash.modframework.text" |
const string Version |
The library's version |
bool IsAvailable |
True when the hooks are installed on this game build |
bool TryGetSource(TMP_Text component, out string source) |
The text the game last set on a component, before rewriters |
- Patch
TMP_Text.text,SetTextor similar yourself. That's the shared hook, and a second patch changes what every other mod sees. - Rewrite dialogue by matching the English text alone when the same line shows up in several places. Use Dialogue's
TryGetLinealongside it so you know which line it is.
Players
Mod authors
- Getting started
- Playing well with others (the guide)
- Going online
- Installer
- Mod reload
- Overrides (no code)
- Graphs (no code, makes things happen)
Tools (F1, developer tools)
- Inspector
- Console
- Code graph
- Bridge (AI clients, MCP)
API
日本語
- ホーム
- プレイヤー向け · ランチャー · FAQ · クラッシュレポート
- はじめての Mod · ほかの Mod と一緒に動かす · 外と通信する Mod · インストーラー · Mod の再読み込み · Overrides · Graphs
- Inspector · Console · コードのグラフ · Bridge
- 中核 API · 操作の登録簿 · Text · Dialogue · Tool window · Assets · Flags and saves · GameEvents · SettingMeta
Links
- Repository
- Releases
- Changelog
- Design records: DESIGN · ROADMAP · CONTENT_POLICY