Build/
- unity stuffdata.json
- exposed metadata for editor useindex.html
- the overlay file to renderthumbnail.###
- preview thumbnail image (use metadata to get the path)
id
- autogenerated idname
- overlay namethumbnail
- relative path to thumbnail from roottags
- array of tag name stringsparameters
- array of parameter names and types- (array item)
name
- parameter nametype
- parameter type
- (array item)
actions
- array of action names- (array item)
name
- action name
- (array item)
Messages are formatted similarly to Redux actions.
window.postMessage(
{
type: "MESSAGE",
payload: {
// ...
}
}
)
Once the DOM is ready, messages can be received and processed, even while Unity loads.
Messages received while Unity loads are buffered, then sent in the order received.
Payload structure
window.postMessage(
{
type: "SET_<TYPE>_PARAMETER",
payload: {
name: "Parameter Name",
// see examples below for the value property
}
}
)
Available types
Data Type | Message Type | Value Structure | Notes |
---|---|---|---|
bool |
SET_BOOL_PARAMETER |
{value: false} |
|
int |
SET_INT_PARAMETER |
{value: 0} |
|
float |
SET_FLOAT_PARAMETER |
{value: 0.0} |
|
string |
SET_STRING_PARAMETER |
{value: ""} |
|
Vector2 |
SET_VECTOR2_PARAMETER |
{value: {x: 0.0, y: 0.0}} |
Components are float s |
Vector3 |
SET_VECTOR3_PARAMETER |
{value: {x: 0.0, y: 0.0, z: 0.0}} |
Components are float s |
Color |
SET_COLOR_PARAMETER |
{value: {r: 0.0, g: 0.0, b: 0.0, a: 0.0}} |
Components are float s ranging from 0.0 to 1.0 |
Color32 |
SET_COLOR32_PARAMETER |
{value: {r: 0, g: 0, b: 0, a: 0}} |
Components are int s ranging from 0 to 255 |
Example: Setting a Color32
parameter
window.postMessage(
{
type: "SET_COLOR32_PARAMETER",
payload: {
name: "Background Color",
value: {
r: 0,
g: 199,
b: 172,
a: 255
}
}
}
);
Payload structure
window.postMessage(
{
type: "RUN_ACTION",
payload: {
name: "Action Name"
}
}
)
Example: Running a Start
action
window.postMessage(
{
type: "RUN_ACTION",
payload: {
name: "Start"
}
}
);