Startup loading API
Preload scenes, script source and assets, then signal the engine to open the start scene.
When to call it
Assign a loading scene in the project settings and attach a Scene Startup Script. The examples request a half-second countdown. See the scene lifecycle guide for setup and troubleshooting.
Calls
Game.loading.timeLeft()Game.loading.loadScene(path)Game.loading.loadScript(path)Game.loading.loadAsset(path)Game.loading.finish(delay)
Variables
| Variable | Type | Required | Description |
|---|---|---|---|
path | project-relative string | Yes | A saved scene, a registered script, or an importable file under assets/. |
delay | finite nonnegative seconds | No | Defaults to zero. Pass 0.0 explicitly in C. |
Return and timing
timeLeft returns the scheduled delay remaining, or nil/null/None before it is scheduled. C returns a nullable RusticValue. loadScene returns the scene name. loadScript and loadAsset return true on success. finish returns true when it first schedules the handoff.
Language examples
Use these snippets inside Start/on_start after generating the Programming Workspace and attaching the script. Python imports rustic, Game and instance from rustic; C++ includes rustic.hpp; C includes rustic.h; C# uses using static Rustic; Java runs inside a Rustic subclass; PHP declares global $rustic, $Game, $instance in its callback. HTML uses an inline script in a ui/ asset. See Lifecycle callbacks for complete registration examples. Public-property examples require a declared integer health property. Scene examples require the named objects to exist before Play.
Lua 5.4
return { Start = function() Game.loading.finish(0.5) end }JavaScript
globalThis.behavior = { Start() { Game.loading.finish(0.5); } };Python
from rustic import Game, run
def on_start():
Game.loading.finish(0.5)
run(globals())C++
void start() { Game.loading.finish(0.5); }C#
// In on_start, with using static Rustic:
Game.loading.finish(0.5);Luau
return { Start = function() Game.loading.finish(0.5) end }C
void start(void) { Game.loading.finish(0.5); }Java
// In on_start in a Rustic subclass:
Game.loading.finish(0.5);PHP
function on_start() { global $Game; $Game->loading->finish(0.5); }HTML / inline JS
globalThis.behavior = { Start() { Game.loading.finish(0.5); } };Constraints and behavior
- Preloads run synchronously. The countdown measures the requested delay in game frame time. The start scene is loaded by the engine at handoff.
- The loading scene is unloaded before global and start-scene callbacks run. A loaded secondary scene remains inactive until switched to.
- Every gameplay language calls the engine-owned API. Rustic supplies SDKs and dispatches callbacks; scripts do not parse requests or serialize responses. See the language guide for complete setup and callback registration.