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 (.dll on Windows, .so on Linux).

No inspector UI

  • Script_OnInspector must be exported with extern "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 using AutoSetting.

Editor window not showing

  • Ensure RenderEditorWindow is exported with extern "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. in Begin) before selecting it in the Inspector.

Hard crash

  • Add null checks for ctx.object and ctx.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 in Script_OnInspector or RenderEditorWindow.

Compilation errors

  • Check your scripts.modu configuration for correct include paths.
  • Ensure you have a C++20 compatible compiler.
  • Verify all required libraries are linked (check linux.linkLib or win.linkLib).