Scripting API
Look up a class in the class index, then select a method or property for its declaration, parameters, return value, and behavior. The sidebar and search cover the same API available in Scripts → Manual → Reference → Full API inside the editor.
OpalScript uses C#-like syntax. It runs Opal's game APIs, not C# or .NET libraries. Scripts inherit from Component; attach them to an object in the Inspector and use Save & Apply before Play.
Common APIs
| Class | Use it to |
|---|---|
| Component | Run lifecycle callbacks, expose Inspector properties, and look up components. |
| Entity | Refer to a scene object and access its components. |
| Input | Read named button, axis, and vector actions. Configure them in Settings → Project Input. |
| RigidBody2D | Set velocity, apply impulses, and read a rigid body's simulation state. |
| SoftBody2D | Move a deformable body and inspect its contacts and deformation. |
| Transform | Read and change an object's transform. |
| Scene | Find, spawn, and destroy objects. |
| Time | Read frame and physics timing, wait, and manage time groups. |
| Game | Read and write declared game variables. |
| Vector2 | Work with 2D positions and vectors. |
| Health | Apply damage and healing. HealthChange describes the result. |
| Event | Subscribe to a typed event or await its next payload. |
Start with a working example
- Jump with Space — create a binding, attach a rigid or soft body, jump from a floor, and diagnose a missing jump.
- Your first component — make an object spin and expose its speed in the Inspector.
- Small gameplay examples — movement, collecting coins, waiting, and chasing a target.
- Flap — build a complete game with gravity, obstacles, score, and restart.
Learn the language and workflow
- Language — types, fields, expressions, control flow, and declarations.
- Lifecycle and collisions — when the engine calls your code.
- Tasks — asynchronous work and cancellation.
- Data, unions, and maps — collections and immutable gameplay data.
- Typed events — declaring events and handling payloads.
- Script Studio — editing, saving, and finding API help.
- Advanced language guide — the detailed language contract.
- Scripts in the User Manual — attaching and using scripts in a project.
Flow and JavaScript Behavior Components are separate authoring APIs. Their references remain available through the editor manual's Flow scripting filter and the Behavior Components guide.