Getting Started
Requirements
- Unity 2022.3 LTS or newer (URP not required)
- New 3D (Core) or similar template
The package is designed to live under:
Assets/PixitGames/BlockWorld/
Your actual folder structure might differ slightly, but the scripts and demo content follow this convention.
Importing the Package
- Import the package into your Unity project.
-
After import, you should see something like:
-
Assets/PixitGames/BlockWorld/Scripts/ Assets/PixitGames/BlockWorld/Prefabs/Assets/PixitGames/BlockWorld/ScriptableObjects/-
Assets/PixitGames/BlockWorld/Demo/ -
Open the demo scene (for example):
-
Assets/PixitGames/BlockWorld/Demo/BlockWorld_Demo.unity -
Press Play to verify everything is working:
-
A chunk-based world appears
- You can move with WASD, jump with Space
- Left click: break blocks
- Drops appear and get picked up
- 1–8: select hotbar slot
- Right click (or your configured key): place the currently selected block
Core Components Overview
WorldSettings (ScriptableObject)
Stores all world-generation parameters:
- Chunk size (X, Y, Z)
- World size in chunks (X, Z)
- Height & mountain noise settings
- Seed
- The list of available blocks and ore rules
WorldGenerator
- Spawns a grid of
Chunkobjects based onWorldSettings. - Fills the internal 3D array of block IDs.
- Builds procedurally generated meshes with colliders.
- Applies ore rules (diamonds, etc) based on depth, rarity, and block type.
Chunk
- Represents a single chunk of the world.
- Holds a 3D array of block IDs.
- Has methods like
GetBlock(x,y,z),SetBlock(x,y,z,id), andBuildMesh().
BlockData (ScriptableObject)
Defines a single block type:
- Numeric ID (byte; 0 is reserved for Air)
- Display name
- Icon (for inventory)
worldPrefab(visual block prefab used in the world)dropPrefab(pickup prefab spawned when broken)- Base break time, pickaxe multipliers, and optional ore settings.
ToolData (ScriptableObject)
Defines a tool:
- Display name
- Icon
inHandPrefab(visual model held in the player hand)- Optional booleans (e.g.
actsAsPickaxe) used later by your logic.
Inventory + UI
Inventorycomponent on the player:- Manages slots (block/tool + count)
- Exposes
CurrentHotbarBlockandCurrentHotbarTool - Raises
OnInventoryChangedevents InventoryUI+InventorySlotUI:- Visualize slots as hotbar and main inventory grid
- Handle drag & drop and selection highlight
BlockInteractor
- Performs raycasts from the camera.
- Highlights and breaks blocks.
- Spawns drops based on
BlockData.dropPrefab. - Places blocks using the currently selected hotbar slot.
- Uses block definitions for base break time and optional tool modifiers.
HeldItemRenderer
- Reads the currently selected hotbar slot from
Inventory. - Spawns either the selected
ToolData.inHandPrefaborBlockData.worldPrefabunder ahandAnchortransform. - Handles scaling and disabling physics on the held item model.
With these components combined, you have a minimal but functional Minecraft-style environment to build upon.