RUSTICDOCSSearch documentation

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

VariableTypeRequiredDescription
pathproject-relative stringYesA saved scene, a registered script, or an importable file under assets/.
delayfinite nonnegative secondsNoDefaults 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

lua
return { Start = function() Game.loading.finish(0.5) end }

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.