Skip to content

Element reference

For each element, this page gives the syntax and the same fields: category, where it can be placed, allowed children, attributes, what it creates, the name when name is omitted, and what is an error. What the categories mean and the order in which elements are expanded are in Syntax overview.

<Object>, <Prefab>, <Row>, <Grid>, and part tags (hosts) accept the following 14 attributes.

AttributesValueMeaningDefault value
namestringGameObject’s name“Name when name is omitted” in each element’s section
keystringA value that distinguishes this GameObject among its siblings (Identity and key). Not written into the prefabSame as name
positionx y zPosition relative to the parent, in meters. Can’t be written on a GameObject under a Canvas (use anchoredPosition or anchoredPosition3D)0 0 0
rotationx y zEuler angles, in degrees. Applied in the same order as Unity’s Quaternion.Euler0 0 0. On a <Prefab>, the value of the prefab’s root
scalex y zScale factor1 1 1. On <Prefab>, the prefab root’s value is kept
activetrue or falseThe GameObject’s active statetrue. On <Prefab>, the prefab root’s value is kept
staticSpace-separated wordsStatic flags (static). Set on that GameObject only, not on the GameObjects under itNone. On <Prefab>, the prefab root’s value is kept
sizew h dSize (meters, 0 or more). Used only for layout and inspect’s counts, and not written to the prefab (Layout). Cannot be written on <Row> or <Grid> (their size is the box their children are laid out in). Cannot be written on a GameObject with a RectTransform (use sizeDelta)None
pivotx y z (each 0 to 1)Where the origin sits inside the size box, as fractions. 0.5 0 0.5 is the bottom center. On a GameObject with a RectTransform, it is the RectTransform’s pivot (x y)The center of the box. 0.5 0.5 on a RectTransform
anchorMinx yThe RectTransform’s anchorMin (only on a GameObject with a RectTransform)0.5 0.5
anchorMaxx yThe RectTransform’s anchorMax (only on a GameObject with a RectTransform)0.5 0.5
anchoredPositionx yThe RectTransform’s anchoredPosition (only on a GameObject under a Canvas)0 0. On a <Prefab> under a Canvas whose root is a RectTransform, the value of the prefab’s root
anchoredPosition3Dx y zThe RectTransform’s anchoredPosition3D. x y is anchoredPosition and z is the z of the position (in the parent Canvas’s units). Can be written only on a GameObject under a Canvas (including a <Prefab> whose root is a RectTransform). Can’t be written together with anchoredPosition, nor on the root of a Canvas (use position)0 0 0
sizeDeltax yThe RectTransform’s sizeDelta (only on a GameObject with a RectTransform)100 100
Assets/Example/Plaza.mochi.xml
<Plaza prefab="true">
<!-- The fountain is static for lighting and batching. -->
<Object name="Fountain" position="0 0 5" rotation="0 45 0" scale="2 1 2" static="lighting batching"/>
<Object name="Banner" position="0 3 5" active="false"/>
</Plaza>
SyntaxNumberExample
Tag and layer attributes (MoCHI has none)MOCHI1005tag-attribute
A static word not in the listMOCHI1009static-unknown
A <Transform> element (position, rotation, and scale are host attributes)MOCHI1004transform-element
An empty nameMOCHI1009name-empty
GameObjects that get a RectTransformA GameObject with a UI component (one that needs a RectTransform, such as Image or Button), and every GameObject under a GameObject with a Canvas. This is the same shape as objects made with GameObject > UI in Unity
Position and sizeWritten with anchorMin, anchorMax, anchoredPosition, sizeDelta, and pivot (each x y). The values mean the same as on Unity’s RectTransform
A GameObject whose parent has no RectTransformSuch as the root of a Canvas. Place it with position (x y z); anchoredPosition and anchoredPosition3D can’t be written
DepthThe z of a GameObject under a Canvas is the third number of anchoredPosition3D, and 0 when it is not written
Size of a Canvas rootWrite sizeDelta on the root of a World Space Canvas. Without it, the root keeps Unity’s default 100 × 100 (0.1 m square at a scale of 0.001), and the warning MOCHI7001 appears. If that size is what you want, write sizeDelta="100 100" and the warning goes away
ArrangingWrite HorizontalLayoutGroup, VerticalLayoutGroup, or GridLayoutGroup. <Row> and <Grid> can’t be written under a Canvas
<Prefab> under a CanvasPlaced with the type of the prefab’s root: the RectTransform attributes when the root has a RectTransform, position, rotation and scale when it has a Transform (objects under it get no RectTransform)
Assets/Example/Board.mochi.xml
<Board prefab="true">
<Object name="Panel" position="0 1.5 2" scale="0.001 0.001 0.001" sizeDelta="800 400">
<Canvas renderMode="WorldSpace"/>
<Object name="Background" anchorMin="0 0" anchorMax="1 1" sizeDelta="0 0">
<Image color="#202020"/>
</Object>
<Object name="Buttons" anchorMin="0 0" anchorMax="1 0" pivot="0.5 0" sizeDelta="0 40">
<HorizontalLayoutGroup spacing="8"/>
<Object name="Prev"><Image color="#FF6060"/><Button/></Object>
<Object name="Next"><Image color="#60A0FF"/><Button/></Object>
</Object>
<Object name="Title" anchorMin="0.5 1" anchorMax="0.5 1" anchoredPosition="0 -20" sizeDelta="300 40" pivot="0.5 1">
<TextMeshProUGUI text="Gallery" fontSize="32"/>
</Object>
</Object>
</Board>

The third number of anchoredPosition3D is the z of the position, and moves part of the UI forward or back from the plane of the Canvas.

Assets/Example/Sign.mochi.xml
<Sign prefab="true">
<Object name="Panel" position="0 1.5 2" scale="0.001 0.001 0.001" sizeDelta="800 400">
<Canvas renderMode="WorldSpace"/>
<Object name="Title" anchoredPosition3D="0 120 -20" sizeDelta="600 80">
<TextMeshProUGUI text="Gallery" fontSize="48"/>
</Object>
</Object>
</Sign>
SyntaxNumberExample
position on a GameObject under a CanvasMOCHI1005rect-position
<Row> under a CanvasMOCHI1004row-in-canvas
anchoredPosition3D on the root of a CanvasMOCHI1005anchored-position3d-root
anchoredPosition and anchoredPosition3D on the same GameObjectMOCHI1005anchored-position3d-with-anchored-position

The 5 hosts in this example don’t write name, so their GameObjects are named GameObject, Row, Grid, KitFrame, and Sign, in that order.

Assets/Hall/Lobby.mochi.xml
<Lobby prefab="true">
<Object/>
<Row/>
<Grid columns="2"/>
<Prefab src="../Kit/KitFrame.prefab"/>
<Sign/>
</Lobby>
<!-- file: Assets/Hall/Sign.mochi.xml -->
<Sign>
<Object name="Board"/>
</Sign>
<PartName prefab="true">
<Props>…</Props>
body
</PartName>
FieldDescription
CategoryRoot element
Where it can liveExactly one, at the top level of the file
Allowed children<Props> (at most one), hosts, component tags, <For>, <If> and <Slot>. <At> cannot be written. Component tags go on the object where the part is placed (the root of the prefab for an entry point)
AttributesOnly the 5 in the table below. The 4 other than prefab set how inspect walks, and can be written only on the root element of an entry point. They are not written into the prefab
What it createsWhen generated as an entry point, one GameObject at the root of the prefab (at the origin). When the file is used as a part, the part tag where it’s used creates the GameObject
Name when name is omittedThe part’s name (name can’t be written on the root element)
What is an errorA name different from the file name (MOCHI1003, root-name-mismatch), the same name as a built-in element (MOCHI3003, builtin-part-name), an attribute not in the table below (MOCHI1005, root-attribute), walkFrom, playerRadius, playerHeight or minPassageWidth on the root element of a part that is not an entry point (MOCHI1005), a value out of range or a binding in walkFrom, playerRadius, playerHeight or minPassageWidth (MOCHI1009), a second <Props> (MOCHI1004, two-props)
AttributesValueMeaningDefault value
prefabtrue・falsetrue makes the file an entry point (Setup and generation)false
walkFromx y zWhere inspect starts walking (meters from the root of the prefab). y is the height of the floor you stand on (layout.walk)The first of the spawns of a VRCSceneDescriptor written in the markup
playerRadiusfloat (at least 0.1)The radius of the walking body (meters). The body is 2 × (radius + 0.005) wide0.2
playerHeightfloat (greater than 0)The height of the walking body (meters). Boxes block the way up to this height plus 0.41.6
minPassageWidthfloat (greater than 0)The passage width you want (meters). Objects reached only through something narrower are listedNone
<Object name="…" position="x y z" …>
children
</Object>
FieldDescription
CategoryHost
Where it can liveDirectly inside the root element, a host, <For>, <If>, or <At>
Allowed childrenHosts, component tags, <For>, <If>, <Slot>
AttributesOnly the common host attributes
What it createsOne GameObject (with a Transform; with a RectTransform when it has a UI component or is under a Canvas)
Name when name is omittedGameObject
What is an errorAn attribute that isn’t a common attribute (MOCHI1005, tag-attribute), a <Transform> child (MOCHI1004, transform-element), an <At> child (MOCHI1004, at-outside-prefab), a <Props> or <Prop> child (MOCHI1004)
<Row spacing="d" align="bottom|center|top" …>
children
</Row>
FieldDescription
CategoryHost
Where it can liveDirectly inside the root element, a host, <For>, <If>, or <At>
Allowed childrenHosts, component tags, <For>, <If>, <Slot>. What gets arranged is the host children, including what <For> and <If> expand to and the content of <Slot>
AttributesThe common host attributes except size, and the 2 in the table below
What it createsOne GameObject. It sets its children’s positions and arranges them along +X (Layout)
Name when name is omittedRow
What is an errorsize (MOCHI1005, row-with-size), a child’s position (MOCHI1005, row-child-position), an <Object> child without size (MOCHI1008, row-child-without-size)
AttributesValueMeaningDefault value
spacingfloat (0 or more)The gap between children, in meters0
alignbottom・center・topHow children of different heights are aligned verticallycenter
<Grid columns="n" spacing="x y" align="bottom|center|top" …>
children
</Grid>
FieldDescription
CategoryHost
Where it can liveDirectly inside the root element, a host, <For>, <If>, or <At>
Allowed childrenHosts, component tags, <For>, <If>, <Slot>. What gets arranged is the host children, including what <For> and <If> expand to and the content of <Slot>
AttributesThe common host attributes except size, and the 3 in the table below
What it createsOne GameObject. It sets its children’s positions and arranges them in a grid (Layout)
Name when name is omittedGrid
What is an errorNo columns (MOCHI1008, grid-without-columns), columns out of range (MOCHI1009, columns-too-many), size (MOCHI1005, row-with-size), an <Object> child without size (MOCHI1008, row-child-without-size)
AttributesValueMeaningDefault value
columnsint(1〜10000)The number of columnsRequired
spacingOne or two float values (x y, 0 or more)The gap between columns and the gap between rows. One value is used for both0
alignbottom・center・topHow children of different heights are aligned verticallycenter
<Prefab src="path.prefab or model.fbx" fill="pattern" overflow="repeat" gap="x y z" …>
children
</Prefab>
FieldDescription
CategoryHost
Where it can liveDirectly inside the root element, a host, <For>, <If>, or <At>
Allowed childrenChildren that change the inside of the prefab (<At>, component tags, <Slot> with path; only in a part’s file, Changes inside a prefab) and children added under the prefab’s root (hosts, <For>, <If>, <Slot> without path)
AttributesThe common host attributes and the 5 in the table below
What it createsOne instance of the prefab (Placing a prefab). src can also be a model file (such as .fbx), placed in the same way as a prefab. Paths also reach into prefabs nested inside the prefab (and prefab variants), using the names shown in Unity’s Hierarchy
Name when name is omittedThe name of the prefab’s root GameObject. Instances added by overflow="repeat" are named original name (1), original name (2), and so on
What is an errorNo src (MOCHI1008), a src that is neither a .prefab nor a model (MOCHI2008), a model Unity has not read yet, outside Unity (MOCHI2017), changing the inside of a prefab in the entry point’s file (MOCHI3013, override-in-entry), a fill with a binding (MOCHI1009, fill-binding), overflow="repeat" without gap when there are more children than mount points (MOCHI1008, repeat-without-gap), more children than mount points (MOCHI3012, too-many-to-fill)
AttributesValueMeaningDefault value
srcPath (.prefab)The prefab to placeRequired
fillA name pattern (Paths and patterns inside a prefab)The mount points the children are attached to (Mount points)None
overflowrepeatAdds instances when there aren’t enough mount points (Repeated placement). Written together with fillNone
gapx y zThe offset between added instances. It goes in the direction turned by the placed prefab’s rotation (the rotation written, or the rotation of the prefab’s root). Written together with overflow="repeat"None
sizeDelta・anchorMin・anchorMax・pivotx yOnly for a prefab whose root has a RectTransform. It overrides the value of the prefab’s root (place it with position). On a prefab whose root has a Transform it gives MOCHI1005The prefab’s value
<PartName propName="value" … name="…" position="x y z" …>
content
</PartName>
FieldDescription
CategoryHost. Read as a part tag when a part with that name exists, even if a component has the same name (a MOCHI3017 warning is reported for each part at the first place it is used)
Where it can liveDirectly inside the root element, a host, <For>, <If>, or <At>
Allowed childrenContent from the caller (hosts, <For>, <If>, <Slot>). The content goes to a <Slot> inside the part (<Slot>). Component tags can’t be written here
AttributesThe common host attributes and the props the part declares (the part’s arguments, props)
What it createsOne GameObject. The contents of the part’s file (except <Props>) become its children
Name when name is omittedThe part’s name
What is an errorAn undeclared prop (MOCHI3005, prop-undeclared), not passing a prop that has no default (MOCHI3008, prop-missing), a prop value that doesn’t fit its type (MOCHI3006, prop-wrong-type), content with no <Slot> to go to (MOCHI2012, slot-unknown), a part that uses itself (MOCHI3004, part-cycle), two parts with the same name (MOCHI3002, duplicate-part-name), a name that is neither an element nor a part (MOCHI3001)
Assets/Hall/Hall.mochi.xml
<Hall prefab="true">
<Wrap>
<Object name="Poster"/>
</Wrap>
</Hall>
<!-- file: Assets/Hall/Wrap.mochi.xml -->
<Wrap>
<Holder>
<Slot/>
</Holder>
</Wrap>
<!-- file: Assets/Hall/Holder.mochi.xml -->
<Holder>
<Object name="Hook"><Slot/></Object>
</Holder>
<ComponentTypeName CSharpPropertyName="value" …/>
FieldDescription
CategoryComponent tag
Where it can liveDirectly inside <Object>, <Row> or <Grid> (adds a component), directly inside <Prefab> or <At> (changes an existing component, only in a part file), and directly inside the root element (adds it to the object where the part is placed; in a part with a T# script, the same object as the script’s UdonBehaviour). To add one under a condition, put an <Object> inside <If> and write it there
Allowed childrenOnly the elements of arrays of structs (<ConstraintSource>, <LOD>, <OptionData>, <Burst>; Arrays of structs)
AttributesWritten with C# property names. The attributes and values you can write are in Component list. Attributes you don’t write keep the default values Unity’s AddComponent gives. Inside a part with a T# script, values that change at runtime can be written too (Parts with a T# script). With key (a simple name of letters, digits and _, read as written), the component’s ID comes from its type and key (Identity and key). On one GameObject, each key is used once across all its components, <UdonBehaviour> included. A #key in a path names an <UdonBehaviour> only
What it createsOne component on the parent GameObject. Directly inside <Prefab> or <At>, nothing is added; existing components of the same type are changed in the order written, first, second, and so on. With add="true", a new one is added even if one of that type is there (other references can point to it)
Name when name is omittedNone
What is an errorDirectly inside <For> or <If> (MOCHI1004, component-in-for), child elements (MOCHI1004), an attribute not in the list (MOCHI1005, component-attribute), changing a component the prefab doesn’t have (MOCHI3010, override-missing-component), a binding in key (MOCHI1009), a key used twice on one GameObject (MOCHI4001, component-key-twice), a key on a tag directly inside <Prefab> or <At> that changes a component already there (it can be written on a tag that adds one with add="true") (MOCHI1005), a value that changes at runtime in a list, UnityEvent or object reference attribute or in material (MOCHI9001)
Assets/Example/Stage.mochi.xml
<Stage prefab="true">
<Light type="Directional"/>
<Seat name="Seat" position="0 0 1"/>
</Stage>
<!-- file: Assets/Example/Seat.mochi.xml -->
<Seat>
<VRCStation/>
<BoxCollider isTrigger="true"/>
<Object name="Cushion" position="0 0.4 0"/>
</Seat>
<For each="rowName" in="folder('path')">
content
</For>
FieldDescription
CategoryControl
Where it can liveDirectly inside the root element, a host, <For>, <If>, or <At> (it can also be content of a part tag)
Allowed childrenHosts, <For>, <If>, <Else>, <Slot>. Component tags can’t be written here
AttributesOnly the 2 in the table below
What it createsNone. It expands its content under the parent of <For>, once per data row
Name when name is omittedNone
What is an errorNo each or in (MOCHI1008), a binding in in (MOCHI2007, for-in-from-prop), a double-quoted folder("…") (MOCHI2007, data-source-double-quote), a component tag directly inside it (MOCHI1004, component-in-for), any attribute other than each and in, including slot (MOCHI1005)
AttributesValueMeaningDefault value
eachName (Names)The row’s name. Inside, write {rowName.column} to read the row’s valuesRequired
infolder('path') or table('path')The data (Data). Read as written; a binding can’t be writtenRequired
Assets/Example/Museum.mochi.xml
<Museum prefab="true">
<For each="room" in="table('../Data/art.csv')">
<Object name="{room.title}" key="{room.key}">
<For each="art" in="folder('../Gallery/art/')">
<Object key="{art.key}" name="{room.title}"/>
</For>
</Object>
</For>
</Museum>
<If test="true|false|{name}">
content
</If>
FieldDescription
CategoryControl
Where it can liveDirectly inside the root element, a host, <For>, <If>, or <At> (it can also be content of a part tag)
Allowed childrenHosts, <For>, <If>, <Else>, <Slot>. Component tags can’t be written here
AttributesOnly test. Write a bool value fixed at generation time
What it createsNone. When test is true, it expands its content under the parent of <If>; when false, it creates nothing
Name when name is omittedNone
What is an errorNo test (MOCHI1008), a test that isn’t a bool (MOCHI5003, if-not-bool), a test whose value changes at runtime (MOCHI5003), any attribute other than test (MOCHI1005)
Assets/Example/Fair.mochi.xml
<Fair prefab="true">
<Booth name="East" lit="true"/>
<Booth name="West" position="4 0 0"/>
</Fair>
<!-- file: Assets/Example/Booth.mochi.xml -->
<Booth>
<Props>
<Prop name="lit" type="bool" default="false"/>
</Props>
<Object name="Counter" size="2 1 1"/>
<If test="{lit}">
<Object name="Lamp" position="0 2 0">
<Light type="Point" range="4"/>
</Object>
</If>
</Booth>
<If test="{name}">
content
</If>
<Else>
content
</Else>
FieldDescription
CategoryControl
Where it can liveOnly right after an <If> (as its next sibling element)
Allowed childrenHosts, <For>, <If>, <Else>, <Slot>. Component tags can’t be written here
AttributesNone. The condition is the test of the <If> right before it
What it createsNothing. When the test of the <If> right before it is false, its content is expanded under the parent of <Else>
Name when name is omittedNone
What is an errorAn <Else> not right after an <If> (MOCHI1004, else-without-if), attributes (MOCHI1005)
<Slot name="…"/>
<Slot path="path inside the prefab" name="…"/>
FieldDescription
CategoryInsertion
Where it can liveIn a part’s file, directly inside the root element, a host, <For>, <If>, or <At>. A <Slot> with path only directly inside <Prefab>
Allowed childrenNone
AttributesThe 3 in the table below
What it createsNone. Of the content written as children of the part tag, it expands the content addressed to this <Slot> under the parent of <Slot>. When the file is generated as an entry point, there is no caller to pass content, so it creates nothing (Passing content with <Slot>)
Name when name is omittedNone
What is an errorPlacing the same <Slot> in two places (MOCHI3011, slot-twice), a slot name the part doesn’t have (MOCHI2012, slot-unknown), a slot with a binding (MOCHI1009, slot-binding), path anywhere other than directly inside <Prefab> (MOCHI1005), child elements (MOCHI1004)
AttributesValueMeaningDefault value
nameName (Names)The name of this <Slot>. Without it, this is the default <Slot/>None
pathA path inside the prefab (Paths and patterns inside a prefab)Can be written only directly inside <Prefab>. Adds the content under that GameObject inside the prefabNone
slot (written on the caller’s content)NameWritten on a content element to choose the name of the <Slot> it goes to. Without it, the content goes to the default <Slot/>. Write it on the children inside <For> and <If>, not on <For> or <If> themselvesNone
<At path="Plate/Label" active="true|false">
children
</At>
FieldDescription
CategoryInsertion
Where it can liveOnly directly inside <Prefab>, in a part’s file
Allowed childrenComponent tags (change existing components on the GameObject it points to) and hosts, <For>, <If>, <Slot> (children added under the GameObject it points to)
AttributesOnly the 2 in the table below
What it createsNone (Changes inside a prefab)
Name when name is omittedNone
What is an errorAnywhere other than directly inside <Prefab> (MOCHI1004, at-outside-prefab), the entry point’s file (MOCHI3013, override-in-entry), no path (MOCHI1008), a path not in the prefab (MOCHI2010, at-path-not-found), any attribute other than path and active (MOCHI1005)
AttributesValueMeaningDefault value
pathA path inside the prefab (Paths and patterns inside a prefab)GameObject names from the prefab’s root, in order. An empty string is the rootRequired
activetrue or falseThe active state of the GameObject it points toThe prefab’s value is kept
<Props>
<Prop … />
</Props>
FieldDescription
CategoryDeclaration
Where it can liveAt most one, directly inside the root element
Allowed childrenOnly <Prop>
AttributesNone
What it createsNone
Name when name is omittedNone
What is an errorA second <Props> (MOCHI1004, two-props), anywhere other than directly inside the root element, a child that isn’t <Prop> (MOCHI1004), attributes (MOCHI1005, props-attribute)
<Prop name="…" type="string" default="…" runtime="true|false"/>
FieldDescription
CategoryDeclaration
Where it can liveDirectly inside <Props>
Allowed childrenNone
AttributesOnly the 4 in the table below
What it createsNone
Name when name is omittedNone
What is an errorNo name or type (MOCHI1008), a type name not in the list (MOCHI3006, prop-type-case), child elements (MOCHI1004, prop-child), the same name as a host attribute (MOCHI3007, prop-reserved), the same name twice (MOCHI3009), a default with a binding (MOCHI5001, default-with-binding), a runtime that isn’t true or false (MOCHI1009), a default on an Object (MOCHI1005, prop-object-default), runtime="true" on an Object (MOCHI1009), an Object on a part with a T# script (MOCHI9001)
AttributesValueMeaningDefault value
nameTextThe prop’s name. Host attribute names (name, key, position, rotation, scale, active, static, size, pivot, anchorMin, anchorMax, anchoredPosition, anchoredPosition3D, sizeDelta) and slot can’t be used. To read it through a binding, use the form of a nameRequired
typeType nameOne of bool, int, float, string, Vector3, Color, Texture, Material, GameObject, Object, matching case exactlyRequired
defaultA value of the type’s typeThe value used when the caller doesn’t pass one. A binding can’t be written here. An Object can’t have oneNone (the caller must always pass it)
runtimetrue or falsetrue makes it a prop that changes at runtime (Parts with a T# script)false