The components you can write on a GameObject in MoCHI. Attribute names and default values are taken from components added with AddComponent in Unity 2022.3.22f1.
The C# property name. A value with no matching property uses the name of the field Unity saves, without m_
An attribute you don’t write
Keeps the value it has when added with Unity’s AddComponent
fontAsset of TextMeshPro
Unless fontSharedMaterial is written, the material becomes that font asset’s own material too
Components added automatically
Components that Unity adds along with it through RequireComponent are added even if you don’t write them. If you write one, that one is used
Values that change together
MoCHI changes the values Unity changes together. For example, writing centerOfMass on a Rigidbody sets automaticCenterOfMass to false, and writing a reverb value sets reverbPreset to User
Values out of range
A value Unity would move into its range when loading gives MOCHI1009 (if AudioSource’s volume were 1.5, Unity would make it 1). The ranges are in the values column of each attribute table. A range that depends on another attribute (Slider’s value between minValue and maxValue) is not checked
Inside the component element, list child elements named after the C# struct. Attributes are the C# field names, and the order written is the array order
When not written
The default array stays. Writing even one replaces it with what is written
A number (1.5). Infinity and -Infinity can be written too
int
A whole number (3)
bool
true・false
string
Strings
Vector2
Two numbers separated by a space (0.5 1)
Vector3
Three numbers separated by spaces (0 1.5 0)
Vector4
Four numbers separated by spaces
Quaternion
Four numbers separated by spaces (x y z w)
Color
#RRGGBB・#RRGGBBAA
Rect
Four numbers separated by spaces (x y width height, 0 0 1 1)
Enumerations
One enum name. Case-sensitive
Enum (combinable)
One or more enum names separated by spaces
LayerMask
Everything, Nothing, layer names separated by ; (Default; Water), or a whole number giving the layer bits. The names are the project’s layers (Tags and Layers in Project Settings); an unknown name gives MOCHI1009
UnityEvent
One or more path:EventName separated by ; (calls SendCustomEvent on a part with a T# script)
Arrays
Every item, separated by ; (Red.mat; Blue.mat). An empty value is an empty list. Each item is written as its own type
From the GameObject the component is on: a child is Bg, a sibling is ../Bg, and the object itself is .
Absolute path
Starts with / (/Panel/Bg). The root is the root of the file it is written in (inside a part, the GameObject where the part is used)
Name
A GameObject is found by its key (its name if it has none). Two siblings with the same name give an error (MOCHI4001)
What it points to
The component of the attribute’s type on the GameObject at the path. A Graphic attribute can also point to an Image (a type that derives from it). If there is none, MOCHI2016; if there is nothing at the path, MOCHI2015
UnityEvent
Write path:EventName separated by ;, as in onClick="../Door:Open; /Sound:Play". It points to a part with a T# script and calls SendCustomEvent on its UdonBehaviour
Inside a placed prefab
A path can go through a <Prefab> and follow the names of the GameObjects inside the prefab (../Frame/Mount). A path that ends at the <Prefab>’s name is the prefab’s root. A UnityEvent can also point to an UdonBehaviour inside the prefab
Passing to a part
A part’s Object prop passes an object from where the part is used. Written inside the part as targetGraphic="{face}" or onClick="{target}:Open", the path is counted from where the part is used (prop values). If the object isn’t there, the error points to where the path is written
From a change inside a prefab
A component change inside <Prefab> or <At> can point too. A relative path starts at the object inside the prefab whose component is changed. A UnityEvent replaces the calls the prefab had