MoCHI Reference (experimental)
MoCHI is experimental (how files are written and what is generated may change in later versions). MoCHI is a markup language that describes objects placed in a VRChat world in .mochi.xml and generates a prefab when you save in Unity (you can write positions, prefabs, components, and repetition driven by images or table rows).
| Page | Description |
|---|---|
| Syntax overview | Categories of elements, how tags map to GameObjects, parts and props, values fixed at generation time and values that change at runtime, expansion order, name scope |
| Element reference | For each element: syntax, where it can be placed, allowed children, attributes, what it creates, the name when name is omitted, errors |
| Value grammar | EBNF and diagnostic numbers for numbers, Vector3, Color, bool, paths, bindings, data, static, and enumerations |
| Setup and generation | Files and parts, entry points, generation on save, handling of generated files, checks before Play and upload |
| Props and identity | How props are passed, identity and key |
| Components and prefabs | Components, material copies, changes inside a prefab, <Slot> content, mount points |
| Component list | Categories of components you can write, value types, asset references, and components you can’t write |
| Physics components | Attributes of Rigidbody, colliders, joints, and more |
| Rendering components | Attributes of renderers, Light, Camera, particles, and more |
| Audio components | Attributes of AudioSource, reverb, and Audio Filters |
| UI components | Attributes of Canvas, Image, Button, layout groups, and more |
| TextMeshPro components | Attributes of TextMeshPro, TextMeshProUGUI, and more |
| VRChat components | Attributes of VRCPickup, VRCObjectSync, VRCMirrorReflection, and more |
| Other components | Attributes of Animator, constraints, NavMesh, and more |
| Layout | size and pivot, how <Row> and <Grid> arrange children, part size |
| Part with a T# script | Generated <Name>.Mochi.cs, runtime props, two-stage generation |
| inspect | Arguments when passing mochi to the MCP inspect tool, and the JSON it returns |
| Errors | List of diagnostic codes, and examples that are errors |
Package
Section titled “Package”| Where it ships | The same Unity package as TsukimiSharp (T#). You don’t need to install a separate package for MoCHI. |
| Relationship to T# | Write a script in T# only when you give a part behavior while the world runs (Part with a T# script). If you build only with parts that have no script, you don’t need to write any T# code |
| Checking from AI | Pass the mochi argument to the MCP server’s inspect (inspect). |
Minimal example
Section titled “Minimal example”<Gallery prefab="true"> <Object name="Wall" position="0 1.5 4" rotation="0 180 0"> <For each="art" in="folder('art/')"> <Frame key="{art.key}" image="{art.file}" position="0 0 0"/> </For> </Object></Gallery><!-- file: Assets/Gallery/Frame.mochi.xml --><Frame> <Props> <Prop name="image" type="Texture"/> </Props> <Object name="Canvas"> <MeshFilter mesh="builtin:Quad"/> <MeshRenderer material="../Art/Frame.mat" mainTexture="{image}"/> </Object></Frame>| Piece | Purpose |
|---|---|
prefab="true" | An attribute that marks this file as the source for generating a prefab. This file becomes the entry point. |
<Object> | Creates one GameObject. |
<For each="art" in="folder('art/')"> | Repeats its content for each image in the art/ folder. |
<Frame …/> | Places the part Frame (Frame.mochi.xml). |
{art.file} | A binding that reads the file column of the repetition row. |
<Props> | Declares the values (props) the part receives. |
<MeshRenderer … mainTexture="{image}"/> | Adds a component. Writing mainTexture copies the .mat and sets the image on it. |
How to read it
Section titled “How to read it”| Notation | Meaning |
|---|---|
Examples starting with samples/ | Examples that don’t error, and reach prefab generation. |
Examples starting with rejected/ | Examples that are errors. The diagnostic code they produce is noted in the text. |
<!-- file: … --> | Marks a file boundary in an example. The first file is the entry point, and paths are relative to the project root. |
| Statements with no example | Content that can’t be checked by whether it errors, such as generation behavior inside Unity. |
Assets the examples reference
Section titled “Assets the examples reference”The examples reference the following 6 assets.
| Path | Contents |
|---|---|
Assets/Kit/KitFrame.prefab | Under root KitFrame: Canvas (MeshFilter and MeshRenderer), Plate (with Label under it), Mount. |
Assets/Kit/KitRoom.prefab | Under root KitRoom: Floor, Mount1, WallEast (with Mount0 and Mount3 under it), Mount2, Door. |
Assets/Art/Frame.mat | A material using the Standard shader. |
Assets/Gallery/art/01_Sea.png | Image |
Assets/Gallery/art/02_Moon.png | Image |
Assets/Data/art.csv | Columns are id, file, title. There are 2 rows, sea and moon, and file points to the two images above. |