Repository navigation
Editor
fanalor-editor is the native editor. It is not part of a shipped game: the player and a game's own binary run a scene with no editor linked.
cargo run -p fanalor-editor
cargo run -p fanalor-editor -- scenes/level.ron
cargo run -p fanalor-editor -- --game platformer.build.ron scenes/platformer.ron
cargo run -p fanalor-editor -- --bridge--bridge listens on loopback so an MCP client can edit, play, and screenshot the running editor. Each edit is one undo entry. See docs/MCP.md.
The window is a hierarchy on the left, an inspector on the right, the scene in the middle, and the asset browser along the bottom.
Scene ▸ New, Open…, Save, and Save As… (Ctrl+N, Ctrl+O, Ctrl+S, Ctrl+Shift+S) work on scenes under the asset root. Double-clicking a scene in the asset browser opens it. The window title names the scene and shows a * while it has unsaved changes. Undoing back to the last save clears the mark. New, Open, and closing the window ask before discarding changes.
Scene ▸ Spawn sprite adds an entity. Click an entity in the hierarchy or in the viewport to select it. Click empty space to clear the selection.
| Gesture | Effect |
|---|---|
| Ctrl-click | Add or remove one entity |
| Shift-click in the hierarchy | The rows between |
| Left-drag on empty ground | A box around what it encloses |
Delete |
Removes the selection. One undo entry |
Ctrl+D |
Duplicate in place |
Ctrl+C / Ctrl+X / Ctrl+V
|
Copy, cut, and paste through the system clipboard, so a copy pastes into another scene or editor window |
Duplicates and pastes are numbered: Coin (1), Coin (2).
The gizmo sits on the last entity picked and moves, turns, and scales the whole selection about it. The inspector edits the fields the selection shares. A field that differs shows —. Editing it writes only that field, on every selected entity, as one undo step.
The hierarchy is a tree. A row shows the entity's Name; an unnamed entity falls back to its index. Drag a row onto another to parent it. Drag it onto the empty space below the tree to make it a root again.
A child's transform is relative to its parent, so moving, turning, or scaling a parent carries its children. Delete on a parent deletes everything under it. Reparenting keeps the entity where it is on screen and is one undo entry.
An entity with a RigidBody or a Collider cannot be parented yet: the solver reads its transform as a world-space value. The refusal is logged.
The gizmos work in world space. Handles sit where the entity is drawn.
| Tool | Key | Drag |
|---|---|---|
| Move | W |
An arm moves along that world axis. The centre square moves freely |
| Rotate | E |
Anywhere on the ring turns the entity about its origin. The drag keeps a running total past half a turn |
| Scale | R |
An arm scales that local axis. The centre square scales both. Scale is a ratio of distances from the origin, so dragging a handle to twice its distance doubles the entity, and dragging through the origin mirrors it |
Each drag is one undo entry.
These camera controls belong to the editor. A game moves its own camera. Scroll and the keys act only while the pointer is over the scene. A middle-drag pan, once started, continues after the pointer leaves. WASD pans only with the right mouse button held, because the bare keys belong to the tools.
| Input | Action |
|---|---|
| Middle-drag | Pan |
| Scroll wheel | Zoom about the cursor |
Right-hold + W A S D
|
Pan |
F |
Reset the camera |
Grid snapping lives with the other editor comforts (Window and the project settings).
The editor starts in edit mode and simulates nothing until Play. The viewport is tinted while it is not editing.
| Button | Action |
|---|---|
| Play / Pause | Play, or pause without leaving play |
| Step | One fixed physics step, while paused |
| Stop | Put the scene back as it was when play began |
Stop is a restore, not an undo. Changes made while playing are discarded. While editing, Ctrl+Z / Ctrl+Y undo and redo. Scene ▸ New, Open, Clear, and Save stop play first.
Window ▸ Profiler shows frame time against the 60 and 30 fps lines, a tree of scopes (update, tick, physics, draw, ui, present) with calls, average, worst, and own time, GPU time per pass where the adapter can time it, and counters such as entities and contacts. Press Play to profile the game rather than the editor at rest.
Window ▸ Network is how the editor hosts a listen server and up to three in-process clients. See Networking.
The asset browser lists the asset root, one tile per entry, with a path bar. It re-reads itself about once a second. A PNG shows its pixels. A file the engine has no loader for is listed and dimmed.
Dragging a texture onto the scene adds a sprite where it was dropped, named after the file and sized to the texture's aspect. Dragging it onto the inspector's Texture field assigns it. Both are one undo entry.
An .atlas.ron shows its first frame and drops in as a sprite on frame 0. The inspector picks the frame, mirrors it, sizes it from a pixels-per-unit, and adds an animation: a list of frames and a rate that plays while the scene is playing. The atlas editor slices a sheet by grid or by hand. cargo xtask pack-atlas <folder> builds a sheet and an .atlas.ron from PNGs (--trim, --out).
The tile palette stamps, rotates, flood-fills, and eyedrops. Tiles can carry their own collision shapes and custom data. Animated tiles and auto-tiling (16-frame terrains and the 47-tile blob) are painted from the editor.
Search in the hierarchy and the asset browser uses Unity's t: syntax for types.
A prefab dropped from the asset browser stays linked to its file. Editing the file, on disk or with Apply to prefab on an edited instance, updates every instance except components that instance has changed. The inspector lists those overrides, each with Revert.
A prefab inside another stays linked to its own file. The outer prefab does not have to be saved again for the inner one to follow its file. Create variant in the asset browser makes a prefab that is another prefab plus overrides: an edit to the base reaches the variant and its instances, except what each overrides. A prefab that would contain itself is refused before saving.
Prefab edit mode opens the prefab as the thing being edited.
The timeline shows a clip's tracks. Record mode keys what is edited under the previewing player. Keys can be copied, cut, and pasted at the playhead. The clip has its own undo history.
Physics ▸ Join selection hinges the last picked body to the other selected body, or to the world. The inspector edits the joint. The collider overlay draws every joint, its axis, and its limits. In play, dragging a body pulls it with a mouse joint. Joint types and breakage are in the physics chapter.
The inspector edits collision layers and the sensor checkbox. Sensors are drawn in their own colour in the debug overlay.
Shadow-caster polygons are edited in the viewport. The particle editor edits curves and gradients against a live preview.
cargo build -p fanalor-editor -p my-game
cargo run -p fanalor-editor -- --game games/my-game/build.ron scenes/main.ronPress Play to run the game crate. Leave it playing and save an edit under games/my-game/src: the editor rebuilds and swaps the new code in. The scene is carried across. A build error is shown in the Game menu, and the last good code keeps running. The editor refuses a library built by a different compiler, engine, or settings, and says why.
How a game crate is shaped is Building Games.