5.0 KiB
com.unity.pipeline
Unity package for remote-controlling a running Unity Editor (or dev Player) over HTTP. A client — CLI, CI, or an agent — connects and executes registered commands: recompile, run tests, eval C#, code-reload files, play-mode control, status/heartbeat.
Layout (standard UPM package)
| Folder | Assembly | Notes |
|---|---|---|
Runtime/ |
Unity.Pipeline |
Ships in development player builds only (defineConstraints: UNITY_EDITOR || DEVELOPMENT_BUILD || ENABLE_RUNTIME_PIPELINE). HTTP server base, command registry, models, runtime commands, code reload, player server. |
Runtime/Attributes/ |
Unity.Pipeline.Attributes |
The [CodeReload] / [OnCodeReload] attributes, unconstrained so user code tagged with them still compiles for release builds (where they are inert — nothing weaves them). |
Runtime/IlInterpreter/ |
Unity.Pipeline.IlInterpreter |
IL interpreter (IlInterpreter VM) that executes eval snippets and reloaded method bodies where Reflection.Emit is unavailable (IL2CPP). Referenced by both Unity.Pipeline and Unity.Pipeline.Editor. |
Runtime/Analyzers/ |
— | Shipped IlInterpreterAnalyzer.dll — Roslyn analyzer (MS002–MS023) surfacing the interpreter's C# subset on [CodeReload] method bodies. Built from IlInterpreter/analyzer/ at the repo root (see its README.md); auto-synced on Release builds — never edit the DLL by hand. |
Editor/ |
Unity.Pipeline.Editor |
Editor-only. Live server + its owner, settings asset, editor commands, test runner, code-reload watcher, build processors (Editor/BuildProcessors/, incl. the code-reload link.xml generator). |
CodeGen/ |
Unity.Pipeline.CodeGen |
ILPostProcessor (Mono.Cecil) for in-place code reload. Root-level by Unity convention (cf. Burst/Entities) — leave as-is. |
Tests/Editor/ |
Unity.Pipeline.Tests.Editor |
EditMode suite (the main one). |
Tests/Runtime/ |
Unity.Pipeline.Tests.Runtime |
PlayMode suite. |
Samples~/ |
— | Code-reload sample scenes. |
Architecture entry points
Runtime/Common/BasePipelineServer.cs— shared HTTP listener + routing (/api/exec,/api/status,/api/commands, …). Subclassed byEditor/EditorPipelineServer.csandRuntime/PlayerSupport/RuntimePipelineServer.cs.Editor/EditorPipelineStartup.cs(PipelineServerStartup) —[InitializeOnLoad]static owner of the live editor server; survives domain reloads; auto-enables autotick.Editor/EditorPipelineManager.cs— inspectable settings asset (Window/Pipeline/Settings...menu).- Commands are discovered via
[CliCommand]attributes. Editor command groups live underEditor/Commands/(Assets, Scenes, GameObjects, Prefabs, Scripts, Build, PackageManager, ProjectSettings, …); runtime commands underRuntime/. - Interpreter path (IL2CPP-safe eval & code reload) —
Runtime/IlInterpreter/ScriptInterpreter.csis the VM core;Runtime/Compilation/IlInterpreterHostBindings.cs(CreateStandard()) builds the host surface it may call — consumed by eval, code reload, and thelink.xmlgenerator (Editor/BuildProcessors/CodeReloadLinkXmlGenerator.cs); see the repo-rootCONTEXT.mdglossary for the drift invariant.Runtime/Compilation/InterpreterCodeReloadExecutor.csroutes reloaded method bodies into the VM;Editor/EditorCodeReloadWatcher.csowns the file-watch → push-reload loop. Editor/Authoring/— helpers shared by state-changing commands:AuthoringUndoScope(collapses a command'sUndo-registered mutations into one step) andProjectPaths/ObjectResolver(authoring-root path resolution + object handles). Destructive/overwriting commands gate onconfirm/dry_runinline (seedelete_asset). Structured multi-field command args implementIStructuredCommandInput(Runtime/Common/). SeeDocumentation~/safety-and-mutations.md,Documentation~/authoring-commands.md, andDocumentation~/creating-commands.md.
Driving & verifying (agents)
Use the unity-pipeline skill, which drives the live editor via the unity CLI.
Canonical verb is command; the auth token is the evalToken field inside the port file
<liveProject>/Library/Pipeline/.unity-pipeline-port, sent as Authorization: Bearer <token>.
Edit→verify loop: make a logical change (may span several files) → command recompile →
poll command recompile_status → command run_tests --filter <TestClass>. The server keeps the
editor ticking while unfocused, so compiles proceed even when focus is elsewhere.
Conventions
- Private instance fields:
m_PascalCase. Private static fields:s_PascalCase. Consts:PascalCase. Exception:Runtime/IlInterpreter/keeps its_camelCasestyle. - Don't
git commit/pushwithout an explicit request. - Changelog entries:
[JIRA-KEY] <one short clause>in Unreleased. No justification/why — state what changed, stop. Plain English, minimal code snippets/API names — describe the change, don't quote the implementation.