SCENE_SCHEMA.md 3.3 KB

Scene JSON Schema Definition

This document outlines the structure of the JSON files generated by the scene parser. The schema uses a highly compressed format with single or double-letter keys to reduce file size. This document serves as the legend to decode that structure.


1. Top-Level Object (SceneData)

The root object of the JSON file.

Key Property Name Type Description
p PrefabsInScene List<string> A list of all unique prefab GUIDs that are referenced by prefab instances within the scene. This property is omitted if no prefabs are used.
h Hierarchy List<GameObjectData> A list of all root GameObjects in the scene. This property is omitted if the scene is empty.

Example

{
  "p": [
    "f7d8f8f8f8f8f8f8f8f8f8f8f8f8f8f8",
    "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6"
  ],
  "h": [
    { ...GameObjectData... },
    { ...GameObjectData... }
  ]
}

2. GameObject Object (GameObjectData)

Represents a single GameObject in the scene hierarchy.

Key Property Name Type Description
e Enabled boolean The active state of the GameObject. Omitted if true (default).
n Name string The name of the GameObject.
t Tag string The tag assigned to the GameObject. Omitted if "Untagged" (default).
l Layer integer The layer number. Omitted if 0 (default).
a AnchorId string The unique fileID of this GameObject within the scene file, used for referencing.
pi PrefabIndex integer If this GameObject is a prefab instance, this is the 0-based index into the root p (PrefabsInScene) list. Omitted if not a prefab.
c Components List<ComponentData> A list of all components on this GameObject. This is only used for non-prefab objects. For prefabs, overrides are stored in ac and rc. Omitted if empty.
ac AddedComponents List<ComponentData> A list of components that were added to this specific prefab instance. Omitted if empty.
rc RemovedComponentAnchorIds List<string> A list of fileIDs for components that were removed from this specific prefab instance. Omitted if empty.
ch Children List<GameObjectData> A list of child GameObjects. For prefabs, this only contains newly added children or original children that have overrides. Omitted if empty.

3. Component Object (ComponentData)

Represents a single Component attached to a GameObject.

Key Property Name Type Description
t Name (Type) string The full C# type name of the component (e.g., UnityEngine.Transform, MyGame.PlayerController).
a AnchorId string The unique fileID of this component within the scene file.
f Fields object For MonoBehaviour scripts, this is a key-value map of all its serialized fields and their values. This property is omitted if the component is not a MonoBehaviour or has no serializable fields.

Example

{
  "t": "UnityEngine.BoxCollider",
  "a": "1234567890"
}
{
  "t": "MyGame.PlayerController",
  "a": "9876543210",
  "f": {
    "m_Speed": 5.5,
    "m_PlayerName": "Hero",
    "m_Target": {
      "type": "UnityEngine.Transform",
      "scene_object_id": 1122334455
    }
  }
}