Phase 4 updates

Phase 4 · Slice 12 ·

The editor GUI (stage 2 of 3): scene view, handles, play mode

  • The editor starts the script host (--managed-dir, --scripts; in the repository it finds the .NET build and loads the sample scripts) and keeps the edited scene loaded in it, reloading on every change. The Scene and Game panes are rendered by SceneRenderer on the window's device into sRGB textures that egui samples through a plain view of the same memory (gamma-encoded, as egui expects; no copy). Views redraw only when the scene, the camera or the size changed.
  • Edit mode as Unity has it: {"edit_mode": true} loads activate everything, but scripts stay asleep (no Awake, OnEnable, Start or updates) unless they are [ExecuteAlways]/[ExecuteInEditMode] (uGUI, TextMeshPro, Light2D, Volume, NavMeshSurface are), and Application.isPlaying is false. No frames run.
  • Scene view: Unity's controls (right-drag looks and WASD/QE flies, Alt+left-drag orbits, middle-drag pans, the wheel zooms, F frames the selection), a ground grid, icons for cameras, lights and audio sources. A click picks through the runtime ({"editor_pick"}: renderers' bounds, then their meshes' triangles, credited to the nearest object the editor knows) or an icon.
  • Handles drawn with egui (move: axes and a free center; rotate: rings; scale: local axes and uniform), Global/Local, W/E/R. A drag moves the object live in the engine ({"editor_transform"}) and commits one SetLocalTransform when released. transform-gizmo-egui was the plan, but its releases for egui 0.37 need Rust 1.96 and the toolchain is pinned to 1.95; our own handles also avoid its reverse-Z mismatch.
  • Play, Pause, Step (Ctrl+P, Ctrl+Shift+P, Ctrl+Alt+P): play loads the scene with scripts and runs a frame per redraw (real time, at most 0.1 s); Stop unloads it and the edit scene comes back. The Game pane draws through the scene's cameras and takes keys, buttons, the mouse and text (Unity's codes, as the player feeds them) while the pointer is over it. Script logs go to the Console with their level. The hierarchy and inspector are read-only while playing.
  • --screenshot <png> runs the editor without a window for a few frames and saves it (--select <name>, --click-scene <fx>,<fy>, --play-frames <n> at 1/60 s, --game), printing what is selected: for tests, scripts and agents.
  • Tests: the edit-mode load doesn't run RollABall's Start and play does; a click mid-view picks the Cabin through its mesh, lower down the Ground (the real binary, CoreCLR and the GPU); dragging the X handle with pointer events moves only along X, commits nothing until release, then one undo step (kittest); camera rays and projection agree.
  • Not yet: in edit mode a TrailRenderer that never ran a frame draws a white blob at its object (the MCP preview shows it too); the grid and handles draw over objects (no depth); inspecting the live scene while playing; the inspector's fields from script metadata; Unity projects in the GUI; MCP agents sharing the GUI's session (stage 3).
  • Next: stage 3: Unity projects (open, save to .unity), scripts' serialized fields in the inspector, the live scene while playing, and agents in the same session through MCP with their presence and review in the GUI.