Scripting Reference
This section summarizes the most important classes and methods you will interact with.
Note: Exact members may vary slightly depending on your version of the kit, but the concepts remain the same.
Inventory
Key members:
InventorySlot[] slotsint hotbarSizeint inventorySizeint selectedHotbarIndexBlockData CurrentHotbarBlock { get; }ToolData CurrentHotbarTool { get; }event Action OnInventoryChanged
Methods:
AddBlock,AddToolConsumeFromSlot,ConsumeFromSelectedHotbarNotifyChanged()
InventorySlot
BlockData blockToolData toolint countbool IsEmptyvoid SetBlock(BlockData b, int amount)void SetTool(ToolData t, int amount)void Clear()
BlockInteractor
- Uses camera raycasts to find blocks.
- Tracks which block is being broken (chunk + local coords).
- Computes break time from
BlockData(and optionally tools). - Sets blocks to Air and rebuilds chunk mesh when broken.
- Spawns drops via
BlockData.dropPrefab. - Places blocks from the selected hotbar slot and consumes inventory.
HeldItemRenderer
- Watches
Inventory.OnInventoryChanged. - Instantiates either a tool’s
inHandPrefabor a block’sworldPrefabunder the hand anchor transform. - Disables physics on the held instance.