Troubleshooting
Common issues and their solutions when working with C++ scripts in Modularity.
Script not running
- Ensure the object is enabled and the script component is enabled.
- Ensure the script path points to a real file and the compiled binary exists.
- Check that the binary matches your platform (
.dllon Windows,.soon Linux).
No inspector UI
Script_OnInspectormust be exported withextern "C"(no wrapper is generated for it).- Make sure the function signature is exactly:
void Script_OnInspector(ScriptContext& ctx)
Changes not saved
- Call
ctx.MarkDirty()after mutating transforms/settings you want to persist. - Ensure you're using
SaveAutoSettings()if usingAutoSetting.
Editor window not showing
- Ensure
RenderEditorWindowis exported withextern "C"and the binary is up to date. - Check View → Scripted Windows in the main menu.
Custom UI style preset not listed
- Ensure
RegisterUIStylePreset(...)ran (e.g. inBegin) before selecting it in the Inspector.
Hard crash
- Add null checks for
ctx.objectandctx.script. - Avoid static pointers to scene objects.
- Don't hold references across frames unless you can validate them.
- Don't call ImGui functions from
TickUpdate— only use them inScript_OnInspectororRenderEditorWindow.
Compilation errors
- Check your
scripts.moduconfiguration for correct include paths. - Ensure you have a C++20 compatible compiler.
- Verify all required libraries are linked (check
linux.linkLiborwin.linkLib).