RUSTICDOCSSearch documentation

HTML/CSS content

Back to Gameplay programming.

Keep the UI source files under ui/. Open the scene that should display the UI. In Explorer, right-click ui/hud.html and choose Set As → Scene Startup Script. Repeat for an external stylesheet such as ui/hud.css. Save the scene and press Play. For example, this HTML displays Ready while the scene is active and logs a message when the scene loads.

html
<!doctype html>
<html>
<body>
  <p>Ready</p>
  <script>
    globalThis.behavior = { Start() { rustic.log("info", "HUD loaded"); } };
  </script>
</body>
</html>

The viewport displays text and simple control shapes from the active scene's enabled HTML links. Enabled CSS links in that scene supply basic background and text colors. Inline scripts use the sandboxed JavaScript API and follow the scene lifecycle. The viewport overlay has no browser DOM or interactive HTML controls. Restart Play after changing the HTML or CSS shown in the viewport.

PHP UI scripts use the scene's gameplay callbacks through rustic.php and rustic_run. For an older .php page that printed markup directly, move its markup to a linked HTML file and put runtime logic in a scene-linked PHP behavior. If a HUD is missing, check that its scene is active and that the HTML and stylesheet are linked and enabled in that scene. If the Console reports an old global or object UI link, attach the source to the appropriate scene. The runtime skips the older link.