Skip to main content
Namespace: MolcaSDK.VR.Inventory
File: Assets/_MolcaSDK/_VR/Scripts/Inventory/VRInventoryManager.cs
World-space inventory ring that follows the player head, toggles via Input System action, and stores XRGrabInteractable items dropped near the UI. Registers with VRInventorySubsystem when present for optional persistence.

When to use

Use VRInventoryManager when trainees should stash grabbed objects (e.g. after Grab step) into fixed slots, open/close the shelf with a controller button, and optionally sync state through VRInventorySubsystem.

Inspector setup

If toggle action is missing, you get a warning and cannot open via input.

Code

Clear every slot and destroy stored objects (dispatches EventConstants.VR.ItemCleared per item):
React to EventConstants.VR.ItemStored, ItemRetrieved, InventoryOpened, InventoryClosed, etc., via EventDispatcher if other systems (scoring, steps) need hooks. IsInventoryVisualReady becomes true only after the open animation finishes — use it before ray/UI tests that assume the panel is fully visible.

API (key members)

Internal storage uses StoreItemInInventory when releasing a grab over the model.

Troubleshooting

  • Cannot open inventory — Assign toggle inventory action and ensure the action map is enabled for the active control scheme.
  • Items never store — Release must happen while hovering the inventory (within about 0.2 world units of the model per source); increase proximity or adjust prefab scale/position. You also need a free slot.
  • “Inventory Slot Prefab must have VRInventoryItem” — Add VRInventoryItem to slot prefab.
  • Persistence not restoring — Requires VRInventorySubsystem on RuntimeManager; persistInventoryState must be true and subsystem must register this manager.
  • Events not firingRuntimeManager.InjectDependencies runs if EventDispatcher is not injected on this instance.

Unity Editor

VRInventoryManager component + inventory canvas.

VRInventoryManager in Unity Inspector or inventory UI

VR inventory setup