C# script generation and editing
Xorin can create and modify Unity C# scripts, ground changes in your project, and wait for fresh Unity compilation evidence before reporting a verified script change as successful.
Supported script workflows
- List and read project scripts, including selected line ranges.
- Generate a new C# script at a project-relative path.
- Edit an existing script with a full rewrite, line replacement, insertion, or find-and-replace operation.
- Attach a compiled
MonoBehaviourto a GameObject. - Run Roslyn-based checks on a snippet or script before it reaches Unity.
Project-aware code discovery
Xorin can search indexed filenames and file contents, inspect a project map, suggest a script location and namespace, find references to a C# class, and estimate the blast radius of a change across code, prefabs, and scenes.
Use an explicit mention such as @PlayerController.cs when one file is central to the request.
Compilation-safe workflow
- Proposed script changes are staged as a request-level change set.
- Xorin runs preflight code analysis against the relevant Unity assemblies.
- The staged files are committed together and Unity performs a fresh compilation.
- If compilation fails, diagnostics are returned to the agent for a bounded repair attempt.
- If the request cannot be repaired, Xorin attempts to restore and recompile the affected scripts. It reports when rollback is unavailable or cannot be verified so you can recover manually.
Review the result
Changed scripts appear in the active checkpoint's Change Log. Expand a script entry to inspect added and removed lines before choosing Accept All or Undo All.
The structured script workflow creates and edits .cs files and attaches compiled scripts. It does not currently provide general structured operations for moving or deleting scripts, renaming types across a project, or editing .asmdef/.asmref files as one verified refactor.