Skip to content

Troubleshooting

This page covers the most common problems when setting up and launching local Melonity scripts.


The script compiles, but does not appear in Melonity

The most common reason is an incorrect build output path.

Check the following:

  • webpack.config.js writes the output file to the Melonity scripts folder
  • the generated .js file really appears in that folder after rebuild
  • Settings -> Scripts -> Load local scripts is enabled
  • the script appears in the local scripts list
  • the script is enabled in that list

If the project still builds into dist, the script will compile successfully, but Melonity will not load it automatically.

If you added a new .js file to the folder and it does not appear in the list yet, press F7 to reload scripts.


The script loads, but callbacks do not work

Usually this means that the script was not registered correctly.

Make sure that:

  • you created a ScriptDescription object
  • you assigned the callbacks to that object
  • you called RegisterScript(...)

IMPORTANT

Without RegisterScript, some parts of the script may still appear to work, for example menu options. However, callbacks will not work.


The menu option appears, but the script logic does not work

This usually means one of two things:

  • the main script callbacks are not registered
  • your logic is disabled by a toggle or an early return

Check:

  • whether RegisterScript(...) is called
  • whether your toggle is enabled
  • whether your OnUpdate or OnDraw function exits too early

npm install fails

This is usually a local Node.js or dependency issue.

Check the following:

  • Node.js is installed correctly
  • you are using an LTS version
  • you are running the command in the project root
  • package.json exists in the current directory

If necessary, remove node_modules and reinstall dependencies.


npm run watch fails

If the watcher does not start, check:

  • dependencies are installed
  • webpack.config.js does not contain invalid edits
  • the output path is valid
  • no other process is locking the target output file

If the error appeared after editing the config, restore the last working version and try again.


Changes are not applied after rebuild

If the project recompiles but nothing changes in Melonity, check:

  • the generated file is written to the correct scripts folder
  • Melonity is loading local scripts
  • the watcher rebuilds the same entry file you are editing
  • the script was reloaded after the file changed

Sometimes the build succeeds, but the wrong file or wrong directory is being updated.


OnDraw or rendering works poorly

OnDraw is called every frame. This means it runs more often at higher FPS, so heavy logic inside OnDraw can hurt performance.

Try to keep OnDraw limited to rendering code only, and move complex calculations to OnUpdate or cached values.


The menu is broken or other visual errors appear

If the menu looks broken or you see other visual problems, check the console first.

Use:

txt
F10

The console is the fastest place to look for runtime errors caused by your script.


Still not working

If the setup still does not work, go through these pages again in order:

  1. Preparing the environment
  2. Creating your first script

Then compare your project with the template repository and check whether your structure, build path, and registration flow match it.