Skip to content

Documentation Example

A reference page that shows every formatting feature these docs use, as it renders on the site. Use it as a cheat sheet when writing or reviewing guides.

Getting started API reference


Headings

The page title above is an h1. Section headings (h2) appear in the right-hand table of contents; sub-headings nest under them.

Heading level 3

Heading level 4

Heading level 5
Heading level 6

Inline text

Regular text with bold, italic, bold italic, strikethrough, highlighted, inserted, and inline code. Subscripts like H2O and superscripts like a2 + b2 = c2.

A link to the Entity reference, an external link to Material for MkDocs, and an autolink: https://luckyrobots.com.

Press Ctrl+S to save the scene and Ctrl+Z to undo. Combinations of three keys work too: Ctrl+Shift+Z redoes.

Abbreviations show a tooltip on hover: scripts use the C# API, and AI assistants connect over MCP.

Inline code with syntax highlighting: Entity? player = Scene.FindEntityByTag("Player");

Icons:

Lists

Unordered & nested

  • Scene graph
    • Entities
      • Components
    • Prefabs
  • Math
  • Physics

Ordered

  1. Derive a class from Entity.
  2. Override a lifecycle method.
  3. Attach the script to an entity.

Task list

  • Install Lucky Engine
  • Create a project
  • Write a first script
  • Record a dataset

Definition list

Entity
The base class for all scripts; override its lifecycle methods.
Component
Data and behaviour attached to an entity, retrieved with GetComponent<T>().

Blockquote

Components hold the data; entities tie them together; scripts give them behaviour.

— The scripting model

Admonitions

Every type, with a custom title:

Note

General information worth calling out.

Abstract / Summary

A high-level overview of what follows.

Info

Neutral, supplementary detail.

Tip

A helpful suggestion or best practice.

Success

Something completed or passing.

Question

A frequently asked question.

Warning

Be careful: this needs attention.

Failure

Something did not work.

Danger

Critical: this can break things.

Bug

A known issue or gotcha.

Example

A worked example follows.

Quote

A cited passage.

A title-less admonition and a collapsible one:

Tip

With no title argument, the type name is used as the heading.

Collapsible (click to expand)

Use ??? for a collapsed block and ???+ for one that starts open.

Collapsible, open by default

This starts expanded.

Code blocks

Plain fenced block:

No language: rendered as plain monospace.

With a language, title, line numbers, and highlighted lines:

Spinner.cs
using Hazel;

public class Spinner : Entity
{
    public float DegreesPerSecond = 90.0f;

    protected override void OnUpdate(float ts)
    {
        Rotation += new Vector3(0.0f, DegreesPerSecond * Mathf.Deg2Rad * ts, 0.0f);
    }
}

Other languages:

from luckyrobots import Session

with Session() as sess:
    sess.connect(timeout_s=30.0, robot="unitreego2")
pip install luckyrobots
{
  "mcpServers": {
    "lucky-engine": {
      "type": "http",
      "url": "http://127.0.0.1:19331/mcp"
    }
  }
}

Code annotations

protected override void OnCreate()
{
    CollisionBeginEvent += other => Log.Info(other.Tag); // (1)!
}
  1. Annotations let you attach explanatory notes to specific lines. Click the marker.

Content tabs

Log.Info("Hello from C#");
print("Hello from Python")

Tabs can hold any content: prose, lists, admonitions.

Inside a tab

Admonitions nest inside tabs just fine.

Tables

Component Purpose Common members
TransformComponent Position / rotation / scale Translation
RigidBodyComponent Dynamic physics body AddForce
CameraComponent Render viewpoint VerticalFOV

(Columns above are left-, left-, and right-aligned.)

Diagram (Mermaid)

graph LR
    A([OnCreate]) --> B[OnUpdate]
    B --> C{Input?}
    C -- key down --> D[Move entity]
    C -- otherwise --> B
    D --> B

Buttons

Primary action Secondary action

Tracked changes (critic markup)

The robot moved slowly swiftly toward the goal. You can replace thiswith that, mark a passage, or leave a side comment.

Footnotes

Scripts run as part of the simulation step1, not on a background worker.

Grid of cards

  • Get started

    Your first Entity script in a few lines.

    Getting started

  • API reference

    The public C# scripting API, grouped by area.

    Reference


  1. Lifecycle callbacks like OnUpdate run inside the simulation step, so avoid blocking them. ↩