Skip to content

Instantly share code, notes, and snippets.

@Volorf
Last active January 28, 2025 21:32
Show Gist options
  • Save Volorf/193796b20115ce6451e0cd4b4015c5b8 to your computer and use it in GitHub Desktop.
Save Volorf/193796b20115ce6451e0cd4b4015c5b8 to your computer and use it in GitHub Desktop.
Boxel Data Structure
// An object that is serialized and saved as a sketchInfo.json in a sketch folder
[Serializable]
public class SketchInfo
{
public string sketchName;
public string dateCreated;
public string sketchID;
public Vector3 parentPosition; // Position of the container where boxels live.
public Quaternion parentRotation; // Rotation of the container where boxels live.
public string appVersion;
public Color sketchBackgroundColor; // For UI previews and the editor scene.
}
// An object that is serialized and saved as a sketchData.json in a sketch folder.
[Serializable]
public class BoxelsData
{
public BoxelData[] data = new []{ new BoxelData()};
}
[Serializable]
public class BoxelData
{
public Vector3Int intPosition = default; // {int: x, int y, int z}.
public Color normalColor = Color.magenta; // {float: r, float: g, float: b, float: a}.
public Color hoverColor = Color.cyan; // It's historical. Plan to remove it in the future.
}
// An example of a serialized BoxelData object
{
"intPosition":{"x":0,"y":0,"z":0},
"normalColor":{"r":0.9490196108818054,"g":0.6000000238418579,"b":0.29019609093666079,"a":1.0},
"hoverColor":{"r":0.5960784554481506,"g":0.3529411852359772,"b":0.13333334028720857,"a":1.0}
}
@BenMcLean
Copy link

note for myself: this is from the X thread https://x.com/Volorf/status/1882916442942722380

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment