Skip to content

00 — Inventory Quickstart

Goal

Learn the minimal inventory loop: give items, read the container, remove from a slot, and clear through the service.


What This Scene Demonstrates

The core inventory flow:

UI input → SceneInventoryService → InvOpResult → live container view

All mutations and reads go through the service. The panel does not write to containers directly. The service result is the source of truth.


What To Look For

  • Give Items triggers GiveExact(...) on the service
  • Backpack Peek shows a live, read-only container view from Get(...)
  • Slot selection is UI-only and does not affect the system
  • Remove x1 calls RemoveFromSlot(...) using the selected index
  • Clear All iterates slots and writes empty stacks through SetAt(...)

Every action returns an InvOpResult, which is shown in Last Result.


Sample Scope

This scene focuses only on:

  • Give (write through service)
  • Peek (read through service)
  • Remove (slot-based mutation)
  • Clear (service-driven iteration)

This scene does NOT cover:

  • Snapshots
  • Sorting, splitting, or transfer
  • Equipment integration
  • Advanced inventory behaviours

These are demonstrated in other scenes.


Authority Note

This scene may include a permissive sample authority setup. If no authority is resolved, mutations are allowed for demonstration purposes.


Networking Reminder

No networking is included. Multiplayer authority and synchronization are the developer’s responsibility.


How To Use

  1. Assign ItemDefinitions in Quick Items
  2. Press Give to add items through the service
  3. Inspect results in Backpack Peek
  4. Click a slot to select it
  5. Press Remove x1 to remove one item via the service
  6. Press Clear All to empty the container through the service
  7. Check Last Result after each action to see success, code, and message

Failure Behaviour

Failures come directly from InvOpResult.

Common patterns:

  • Give fails → capacity, filters, or authority → Check item setup, container configuration, or authority

  • Remove fails → invalid index, empty slot, or authority → Select a valid non-empty slot

  • Clear fails → service or authority issue → Check container id and service setup

The result code and message describe exactly what went wrong.


Behind The Scenes

This panel uses only public service APIs:

  • SceneInventoryService.GiveExact(...)
  • SceneInventoryService.Get(...)
  • SceneInventoryService.RemoveFromSlot(...)
  • SceneInventoryService.SetAt(...)
  • InvOpResult

No direct container writes occur outside the service.


Key Takeaway

Inventory operations are service-driven and result-first. You give, read, and mutate through the service, and use the result to understand what happened.

Everything else builds on this loop.