A part is the named set of objects that one .mochi.xml file represents. In this example, an entry point in Assets/Hall/ uses the part Sign from Assets/Parts/.
Assets/Hall/Hall.mochi.xml
<Hallprefab="true">
<Signposition="0 2 0"/>
</Hall>
<!-- file: Assets/Parts/Sign.mochi.xml -->
<Sign>
<Objectname="Board"scale="2 1 0.1">
<MeshFiltermesh="builtin:Cube"/>
</Object>
</Sign>
File name
<part name>.mochi.xml. Only the lowercase .mochi.xml extension is treated as a part
Root element
The same name as the part, case-sensitive
Creating a file
In the Project window, Assets > Create > MoCHI File creates an entry point template in the selected folder. The name you type becomes the file name and the root element’s name, with spaces turned into _. A name that can’t be a part name isn’t created, and the reason appears in the Console
Using a part
Write the part’s name as a tag (<Sign/>)
Where parts are searched for
Everything under the project’s Assets/ and Packages/ folders (packages that Unity keeps only in its package cache are not searched). There are no imports
Duplicate part names
If two parts share a name, using that name is an error. It’s not an error if nothing uses it
Names that can’t be used
Object, Prefab, Props, Prop, For, If, Else, Slot, At, Row, Grid and Transform cannot be used as part names (the names of the built-in elements, and Transform, which is not an element)
A part inside a part
This is allowed, but it’s an error for a part to use itself
Syntax
Number
Example
A root element whose case differs from the file name
An entry point is a file whose root element has prefab="true". On save, MoCHI generates one prefab from this file.
Assets/Example/Stage.mochi.xml
<Stageprefab="true"position="0 1 0">
<Objectname="Floor"/>
</Stage>
Root element attributes
prefab. The value is true or false. The root element of an entry point also takes the inspect walking settings walkFrom, playerRadius, playerHeight and minPassageWidth (Root element)
An entry point’s props
There’s no caller to pass values, so every prop needs a default
The prefab’s root
The GameObject’s name is the part’s name. Its position is the origin and can’t be changed
What generation on save covers
Only entry points under Assets/. Files under Packages/ are not generated on save, even with prefab="true"
After the entry point, or a file it reads (a part, prefab, image, table, or material), is saved and Unity has imported it
Saving during Play mode
Generation happens after returning to Edit mode
Where generated files go
One folder per entry point, under Assets/MoCHI Generated/. The folder is named after the entry point’s path with the leading Assets/ and trailing .mochi.xml removed
The prefab (<part name>.prefab), material copies (Material copies), and a generation record (.mochi-record)
Files it writes
Only files whose contents change
On error
The prefab and materials are not written; the previous output is kept (the generation record, and the <Name>.Mochi.cs of parts with a T# script, are written). The error appears in the Console as [MoCHI] <file>(<line>,<column>): error MOCHInnnn: <message>
On warning
Shown in the Console as [MoCHI] <file>(<line>,<column>): warning MOCHInnnn: <message>, only when generation writes or deletes a file. A save that changes nothing shows no warnings
On success
The Console shows [MoCHI] Generated <prefab path> from <entry point>.
Generation for that entry point pauses, and the Console shows an error. Uploading the world is also stopped
Discarding changes
Use Regenerate (discard changes) in the generated file’s Inspector, or TsukimiCode > MoCHI > Regenerate, to discard the changes and regenerate
To change what’s generated
Change the .mochi.xml, or use a prefab override placed in the scene
A prefab saved without changes
Opening a generated prefab in Unity and saving it without changing anything is not treated as a hand edit
Deleting a generated prefab
That entry point stops generating. Use Regenerate to resume it, or remove prefab="true" if generation is no longer needed
Deleting the .mochi.xml
The generated files remain, and the Console shows a warning. If they’re no longer needed, delete them with TsukimiCode > MoCHI > Clean Up Outputs Without a Source (Deleting generated files whose source is gone)
Moving or renaming inside Unity
The generated folder moves along with it. The prefab’s GUID doesn’t change, so references from the scene are preserved
TsukimiCode > MoCHI > Regenerate. MoCHI > Regenerate in the Project window’s right-click menu does the same
What to select
A .mochi.xml, or an asset inside a generated folder
Behavior
Discards hand edits and regenerates. Also resumes an entry point that had stopped generating
A file without prefab="true"
Nothing is generated, and the Console shows a warning
Regenerating everything
TsukimiCode > MoCHI > Regenerate All (also under MoCHI in the right-click menu). With nothing selected, it regenerates every entry point under Assets/ in the same way
TsukimiCode > MoCHI > Clean Up Outputs Without a Source. It is not in the Project window’s right-click menu
What it runs
Entry points whose generation record is still under Assets/MoCHI Generated/ but whose .mochi.xml no longer exists. Nothing needs to be selected. As long as the .mochi.xml exists, an entry point is not a target even if prefab="true" was removed
When there is nothing to delete
Nothing is deleted, and the Console shows [MoCHI] Every output generated by MoCHI still has its .mochi.xml. Nothing to clean up.
Confirmation window
Appears before anything is deleted. For each entry point it lists the source path, and the number of generated files and their folder (from the 11th on, only the count is shown). Delete deletes them; Cancel deletes nothing
What is deleted
The generated files listed in the generation record that are still in the folder, and the generation record itself. Files that MoCHI did not generate are not deleted
Deleting folders
Only folders that end up empty are deleted, working upward under Assets/MoCHI Generated/. A folder that still holds other files (including the generated files of another entry point) is kept
Effect on scenes and prefabs
Instances of a deleted prefab become Missing Prefab in the scenes and prefabs that placed them
What is shown when it finishes
The Console shows [MoCHI] Deleted the files generated from n MoCHI source(s) that no longer exist: <source paths>. Any folders that were kept are named in Kept <folder>: … on the same line. Anything that could not be deleted is named in the warning [MoCHI] Could not delete <path>.
When leaving Edit mode, every entry point is checked. Anything out of date gets a Console warning after entering Play mode. Play is not stopped
Before uploading the world
When the world is built with the VRChat SDK, every entry point under Assets/ is checked. If an entry point whose generated prefab the uploaded scene uses has an error, is out of date, was changed by hand, or is waiting for a compile, the build stops
Entry points the scene does not use
They are checked, and a problem is reported as a warning in the Console. The build does not stop
What doesn’t stop the upload
An entry point that has stopped generating, and an entry point whose source file was deleted
The message when it stops
[MoCHI] Build stopped: n generated prefab(s) do not match their source. followed by how to fix it