ShadowsOfDoubt UI Scaler
Unifies UI scale via Canvas Scaler for Shadows of Doubt. Config hot-reload, configurable hotkeys (F9 toggle, F11/F10 ±5%), and safe per-canvas application. Keeps fonts/sprites crisp; world-space optio
模組介紹 作者原文
Shadows of Doubt UI Scaler
Plugin GUID: khundian.sod.uiscaler
Name: Shadows of Doubt UI Scaler
Version: 1.0.1
Description: UI scaler + configurable hotkeys.
Unifies UI scale via Canvas Scaler for Shadows of Doubt. Config hot-reload, configurable hotkeys (F9 toggle, F11/F10 ±5%), and safe per-canvas application. Keeps fonts/sprites crisp; world-space optional. Requires BepInEx 6 IL2CPP.
Features
- Global UI scaling via Canvas Scaler (Scale With Screen Size) with configurable reference resolution (default 1920×1080), match factor (0–1), and a multiplier (0.10×–5.00×).
- Configurable hotkeys (defaults: Toggle F9, Scale Up F11, Scale Down F10). Each press adjusts by 5% and saves after a short idle.
- Hot reload of the config file. Edits on disk are debounced and re-applied safely while the game is running.
- Scene-change detection by polling (SceneManager.GetActiveScene()), ensuring compatibility with IL2CPP/Roslyn edge-cases (no event subscription required).
- Batched layout rebuilds: Canvas.ForceUpdateCanvases() is called once per rescan/revert pass to avoid spikes.
- Efficient discovery of canvases using Object.FindObjectsOfType(true), with filters:
- ActiveSceneOnly (affect canvases in the active scene)
- IncludeWorldSpace (optional world-space canvases)
- Name filters via include/exclude tokens
- Zero-alloc pruning of destroyed canvases and best‑effort pre‑sizing of internal collections for large scenes.
- Periodic rescan interval is configurable (Engine:RescanEveryMilliseconds, default 2000 ms). Heavier work runs on a timed tick; only input runs every frame.
Requirements
- Shadows of Doubt (Unity 2021.3)
- BepInEx 6 (IL2CPP)
Installation
Manual (zip)
- Install BepInEx 6 (IL2CPP) for the game.
- Copy the plugin DLL to:
\BepInEx\plugins\ShadowsOfDoubt.UIScaler\ShadowsOfDoubt.UIScaler.dll
- Launch the game once. The config file will be created at:
\BepInEx\config\khundian.sod.uiscaler.cfg
(optional)
Zip structure:
BepInEx/
plugins/
ShadowsOfDoubt.UIScaler/
ShadowsOfDoubt.UIScaler.dll
manifest.json
README.md
LICENSE
Usage
Defaults
- Enabled: true
- Scale: UiScaleMultiplier = 1.00 (vanilla size)
- Reference Resolution: 1920 × 1080
- Match: 0.50 (balanced width/height)
- Rescan: 2000 ms
- Hotkeys:
- Toggle: F9 (on/off)
- ScaleUp: F11 (+5%)
- ScaleDown: F10 (−5%)
In-game
- Press F9 to enable/disable (when disabling, original Canvas settings are restored).
- Press F11 / F10 to adjust the global UI scale by ±5%.
- A small toast confirms the change (e.g., UI Scale: 1.15x).
Configuration
Location:
\BepInEx\config\khundian.sod.uiscaler.cfg
The file includes a readable header and per-setting comments. Saving the file hot-reloads and re-applies settings while the game is running—no restart needed.
Key Settings (overview)
[General]
- Enabled — master switch
[CanvasScaler]
- UiScaleMultiplier (0.10–5.00) — global UI size multiplier (1.00 = vanilla)
- ReferenceWidth / ReferenceHeight — reference resolution (default 1920×1080)
- MatchWidthOrHeight (0..1) — 0 = width, 1 = height, 0.5 = balanced
[Filter]
- ActiveSceneOnly — consider canvases only from active scene
- IncludeWorldSpaceCanvases — include World Space canvases (default false)
- CanvasInclude / CanvasExclude — comma-separated name tokens; exclude wins over include
[Perf]
- RescanEveryMilliseconds — periodic re-scan to catch newly spawned canvases
[Hotkeys] (names from Unity KeyCode)
- Toggle (default F9)
- ScaleUp (default F11)
- ScaleDown (default F10)
How It Works (Technical)
- Finds canvases (including inactive) and attaches/updates a CanvasScaler set to Scale With Screen Size.
- Applies UiScaleMultiplier by adjusting the reference resolution inversely (preserves pixel density).
- Stores original scaler settings and reverts them when disabling the plugin.
- Watches the config file; on any save, it reloads and re-applies if still enabled.
Troubleshooting
- World-space UI breaks
World-space canvases are excluded by default. Enab
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。
下面這些內容需要先安裝,否則該模組不會生效: