Skip to content

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).

PageDescription
Syntax overviewCategories 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 referenceFor each element: syntax, where it can be placed, allowed children, attributes, what it creates, the name when name is omitted, errors
Value grammarEBNF and diagnostic numbers for numbers, Vector3, Color, bool, paths, bindings, data, static, and enumerations
Setup and generationFiles and parts, entry points, generation on save, handling of generated files, checks before Play and upload
Props and identityHow props are passed, identity and key
Components and prefabsComponents, material copies, changes inside a prefab, <Slot> content, mount points
Component listCategories of components you can write, value types, asset references, and components you can’t write
Physics componentsAttributes of Rigidbody, colliders, joints, and more
Rendering componentsAttributes of renderers, Light, Camera, particles, and more
Audio componentsAttributes of AudioSource, reverb, and Audio Filters
UI componentsAttributes of Canvas, Image, Button, layout groups, and more
TextMeshPro componentsAttributes of TextMeshPro, TextMeshProUGUI, and more
VRChat componentsAttributes of VRCPickup, VRCObjectSync, VRCMirrorReflection, and more
Other componentsAttributes of Animator, constraints, NavMesh, and more
Layoutsize and pivot, how <Row> and <Grid> arrange children, part size
Part with a T# scriptGenerated <Name>.Mochi.cs, runtime props, two-stage generation
inspectArguments when passing mochi to the MCP inspect tool, and the JSON it returns
ErrorsList of diagnostic codes, and examples that are errors
Where it shipsThe 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 AIPass the mochi argument to the MCP server’s inspect (inspect).
Assets/Gallery/Gallery.mochi.xml
<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>
PiecePurpose
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.
NotationMeaning
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 exampleContent that can’t be checked by whether it errors, such as generation behavior inside Unity.

The examples reference the following 6 assets.

PathContents
Assets/Kit/KitFrame.prefabUnder root KitFrame: Canvas (MeshFilter and MeshRenderer), Plate (with Label under it), Mount.
Assets/Kit/KitRoom.prefabUnder root KitRoom: Floor, Mount1, WallEast (with Mount0 and Mount3 under it), Mount2, Door.
Assets/Art/Frame.matA material using the Standard shader.
Assets/Gallery/art/01_Sea.pngImage
Assets/Gallery/art/02_Moon.pngImage
Assets/Data/art.csvColumns are id, file, title. There are 2 rows, sea and moon, and file points to the two images above.