Core Concepts¶
Data-Driven Setup¶
Block World uses ScriptableObjects for most reusable gameplay data:
| Data Asset | Script | Purpose |
|---|---|---|
| World Settings | WorldSettings |
Chunk sizes, world dimensions, terrain noise, biomes, block registry |
| Block Data | BlockData |
Block ID, prefab, drop, break time, tool multiplier, ore settings |
| Biome Data | BiomeData |
Surface blocks, ores, height offsets, trees, entity spawns |
| Craft Recipe | CraftRecipeData |
Recipe grid, shapeless/shaped mode, output |
| Item Data | ItemData |
Items, tools, weapons, armor-like metadata, in-hand prefab |
| Tool Data | ToolData |
Legacy/simple tool asset support |
Runtime Flow¶
WorldGeneratorreadsWorldSettings.- Chunks are created and filled with block IDs.
- Biome rules choose surface, subsurface, deep blocks, ores, trees, and entities.
Chunk.BuildMesh()converts visible blocks into combined meshes.BlockInteractorlets the player break, place, attack, and interact.- Inventory, crafting, drops, and save data react to gameplay changes.
Block IDs¶
Block IDs are bytes. 0 is reserved for air.
All placeable and generated blocks should be registered in:
WorldSettings.blocks
If a block ID is not registered, chunks cannot resolve its world prefab or gameplay data.
Generated Versus Source Assets¶
Generated block/item folders are normal Unity assets. They can be edited manually after creation, but keep IDs and registry references consistent.
Generated blocks usually contain:
BlockData-Name.assetBlock_Name.prefabDrop_Name.prefab- optional
Recipe-Name.asset - material assets