File formats

Every file the editor saves is YAML. Saving a loaded file gives the same bytes, so files diff cleanly.

Project: .cairnproject

The project's folder is the asset root. The file names the start scene by ID.

Project: Coin Run
StartScene: 1766693425610918104
Version: "1.2.0"
Icon: 8040926846941336792
Layers: [Default, Player, Coin]
Physics:
  Gravity: [0, -9.81, 0]
  IgnoredLayerPairs:
    - [Coin, Coin]
Input:
  MoveX: [D, -A, Right, -Left, Gamepad LeftX]
  Jump: [Space, Gamepad A]

Version, Icon, Physics and Audio are left out when they have their default values.

Scene: .cairnscene

Scene: Test Scene
Version: 1
Entities:
  - Entity: 16023948871245500004
    Name: Player
    Tag: Player
    Layer: 1
    Transform:
      Translation: [0, 1, 0]
      Rotation: [0, 90, 0]
      Scale: [1, 1, 1]
  - Entity: 5120394857761203005
    Name: Player Model
    Tag: ""
    Layer: 1
    Parent: 16023948871245500004
    Transform:
      Translation: [0, 0, 0]
      Rotation: [0, 0, 0]
      Scale: [1, 2, 1]
    MeshRenderer:
      Mesh: Cube
      Materials: [4410277391850265201]
  • Rotation is Euler angles in degrees.
  • Entities are listed parent first, and the order in the file is the order of siblings.
  • Each component is a key under its entity.
  • Built-in meshes are written by name: Cube, Sphere, Plane. Every other asset is written as its ID.

A script's own values for its fields are under Fields. A field that points at an entity or an asset is a small map:

    Scripts:
      - Script: 4479375507684573014
        Fields:
          Speed: 8
          Greeting: "Hello"
          Target: {Entity: 16998895983735067180}
          Bullet: {Asset: 16607444699855248007}

Prefab: .cairnprefab

The same form as a scene, with Prefab: in place of Scene:. The first entity is the prefab's top.

In a scene, an instance of a prefab is stored as what it changed. See Prefabs.

Material: .cairnmat

Material: Coin
BaseColor: [1, 0.8, 0.1, 1]
Metallic: 1
Roughness: 0.3
NormalScale: 1
OcclusionStrength: 1
Emissive: [0, 0, 0]
AlphaMode: Opaque
AlphaCutoff: 0.5
DoubleSided: false

Textures are added as BaseColorTexture, MetallicRoughnessTexture, NormalTexture, OcclusionTexture and EmissiveTexture, each an asset ID.

Animator: .cairnanimator

Animator: Arm
Parameters:
  Bend: 0
Start: Sway
States:
  - Name: Sway
    Clip: 9293789681265543596
    Loop: true
    Speed: 1
    Events:
      - {Time: 0.5, Function: OnSwayed}
  - Name: Bend
    Clip: 17617176335982938140
    Loop: false
    Speed: 1
Transitions:
  - From: Sway
    To: Bend
    When: Bend
    Fade: 0.25
  - From: Bend
    To: Sway
    When: not Bend
    AtEnd: true
    Fade: 0.25

When is a condition on the parameters, written as text: Speed > 0.1 and Grounded.

Meta: .meta

One beside every asset, holding its ID.

UUID: 7996841021279324550
Type: Texture

A model's .meta also lists the IDs of its parts, under keys such as Mesh/0.

Pack: .cairnpak

An exported game's files in one binary file. The runtime mounts it as a folder, so a path into it reads like any other. Files are stored as they are, uncompressed.

Saves and settings

Saved games and the player's settings are YAML files in the game's own folder in the user's data directory. See Saving and scenes.

Compatibility

When a component gains a field, older files still load: the field takes its default. The Version in a scene is raised only for a change older engines cannot read.