add_autoload
Register a new autoload in a Godot project by providing a name and script path. Optionally set as a global singleton; validate scripts to prevent headless mode crashes.
Instructions
Register a new autoload in a project. autoloadPath accepts "res://..." or a project-relative path (auto-prefixed). singleton defaults true (accessible globally by name). No Godot process required. Warning: autoloads initialize in headless mode — a broken script will crash every subsequent headless op; validate before adding. Errors if an autoload with the same name already exists; use update_autoload to modify.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | Path to the Godot project directory | |
| autoloadName | Yes | Name of the autoload node (e.g. "MyManager") | |
| autoloadPath | Yes | Path to the script or scene (e.g. "res://autoload/my_manager.gd" or "autoload/my_manager.gd") | |
| singleton | No | Register as a globally accessible singleton by name (default: true) |