Lucky Engine Scripting¶
Write C# to drive behavior in your Lucky Engine scenes — move entities, respond to input and collisions, query physics, control robots, and define reinforcement-learning tasks.
-
The scripting model, your first
Entityscript, and the update lifecycle. -
Task-focused walkthroughs: input, components, physics, and the robot/MDP APIs.
-
Every public type in the
Hazelscripting namespace, generated from source.
A first taste¶
Every script is a class that derives from Entity. Override the
lifecycle methods you care about and use the engine APIs from inside them:
using Hazel;
public class Spinner : Entity
{
// Public fields appear in the Inspector — see "Editor Attributes" in the reference.
public float DegreesPerSecond = 90.0f;
protected override void OnUpdate(float ts)
{
// ts is the frame delta time, in seconds. Rotation is in radians.
Rotation += new Vector3(0.0f, DegreesPerSecond * Mathf.Deg2Rad * ts, 0.0f);
}
}
Attach the compiled script to an entity via a Script component in the editor, and
OnUpdate runs every frame.
How these docs are built¶
The API reference is generated directly from the engine's C# source
(Hazel-ScriptCore), so signatures never drift from the code. The guides are
hand-written. Use the version selector in the header to switch between engine releases
(e.g. 2026.1 ↔ 2026.2).
Improving the reference
Reference text comes from /// XML doc comments in the engine source. To improve a
description, edit the doc comment on the type or member in Hazel-ScriptCore — the
next docs build picks it up automatically.