WorldDefinition
A world partitioned into a 3D grid of cells, each authored as its own additive scene.
Nebula.World · Packages/com.1by3.nebula/World/WorldDefinition.cs[CreateAssetMenu(menuName = "Nebula/World Definition", fileName = "World")]
public sealed class WorldDefinition : ScriptableObjectA world partitioned into a 3D grid of cells, each authored as its own additive scene. Cells are authored cell-local: everything in a cell scene sits around that scene's own origin, and at runtime the WorldStreamer places the cell at its grid position relative to the current WorldOrigin. Nothing ever needs an absolute world coordinate, so a world can be far larger than float precision allows.
Cell (x, y, z) is centred on (x, y, z) * CellSize: cell (0,0,0) covers ±CellSize/2 on every axis, which is exactly how a scene authored around the origin already looks. A flat world is a single row of cells on Y; a world that shards verticality uses more.
Fields
WorldName
public string WorldName = "World";Used to name cell scenes: <WorldName>_<x>_<y>_<z>.unity.
CellSize
public Vector3 CellSize = new Vector3(256f, 256f, 256f);Size of one cell in metres. Adjustable per world; every cell of a world has the same size.
SceneFolder
public string SceneFolder = "Assets/Scenes/World";Editor: folder new cell scenes are created in.
Cells
public List<CellEntry> Cells = new List<CellEntry>();Methods
Invalidate
public void Invalidate();Drop the coordinate index (call after editing Cells in place).
HasCell
public bool HasCell(Vector3Int coord);TryGetCell
public bool TryGetCell(Vector3Int coord, out CellEntry entry);GetCell
public CellEntry GetCell(Vector3Int coord);SetCell
public CellEntry SetCell(Vector3Int coord, string scenePath);Add or replace the entry for coord.
RemoveCell
public bool RemoveCell(Vector3Int coord);CoordOf
public Vector3Int CoordOf(Vector3 framePosition, Vector3Int origin);Grid coordinate of a position expressed in the frame whose origin cell is origin.
FrameOrigin
public Vector3 FrameOrigin(Vector3Int coord, Vector3Int origin);Where cell coord's centre sits in the frame whose origin cell is origin.
FrameBounds
public Bounds FrameBounds(Vector3Int coord, Vector3Int origin);TryGetExtent
public bool TryGetExtent(out Vector3Int min, out Vector3Int max);Axis-aligned extent of the defined cells in grid coordinates (min/max inclusive). False when there are none.
SceneNameFor
public string SceneNameFor(Vector3Int coord);Scene name convention: World_1_0_n2 for cell (1, 0, -2) of world "World".
ScenePathFor
public string ScenePathFor(Vector3Int coord);SceneNameOf
public static string SceneNameOf(string scenePath);TryParseSceneName
public static bool TryParseSceneName(string sceneName, out string worldName, out Vector3Int coord);Parse a scene name produced by SceneNameFor back into a coordinate.
Nested types
CellEntry
[Serializable]
public sealed class CellEntryFields
Coord
public Vector3Int Coord;ScenePath
public string ScenePath = "";Project path of the cell's scene (Assets/.../Name.unity). The scene must be in the build settings.
Properties
SceneName
public string SceneName { get; }