Scripting Guide
Attach gameplay logic to entities using ScriptComponent lifecycle callbacks and CollisionCallbackComponent for collision events.
# ScriptComponent
ScriptComponent attaches three lifecycle callbacks to an entity: on_start, on_update, and on_destroy. All callbacks are optional — only provide the ones you need.
# Callback Signatures
Each callback receives the entity ID and a context object. The on_update callback additionally receives the frame delta time.
# Error Budget
Scripts that throw exceptions accumulate an error count. After exceeding the budget (default: 5 errors), the script's callbacks are automatically disabled to prevent log spam and performance degradation.
# Example: Rotating Cube
A complete example attaching a script that rotates a cube around the Y axis at 90 degrees per second.
# CollisionCallbackComponent
CollisionCallbackComponent provides enter/stay/exit collision events. The engine tracks collision pairs across frames using a CollisionEventCache to determine transitions.
# Example: Collision Detection
A pickup item that logs a message when another entity enters its trigger volume.