Display Inventory state and feedback
When to use
Configure Inventory presentation after the logical workflow is working and users need to see item visuals, quantities, or action results. Retained visualization observes the board; it does not own Inventory state.
Before you start
Configure a GridBoardView, renderer, layout, and structure library node builder. Item visuals come from the authored structure assets described in Add Inventory to a board in Unity.
Add GridInventoryQuantityRenderer
as a structure decoration renderer only when stack quantities should be visible. Its renderer must
provide the Labels capability. Quantity 1 intentionally has no badge.
Procedure
Show an action result
Publish feedback after preview or apply. Quantity changes use generic success or invalid feedback; move and rotate actions can also identify their Inventory-specific affected cells.
Excerpt — publish feedback for one Inventory action. Tested using public APIs.
public static void ShowActionFeedback(
GridBoardView view,
IGridAction action,
GridActionResult result)
{
view.ApplyInventoryActionResult(action, result);
}
Show transfer feedback
Apply the same result to each board view with the correct source/destination flag.
Excerpt — publish source and destination transfer feedback. Tested using public APIs.
public static void ShowTransferFeedback(
GridBoardView sourceView,
GridBoardView destinationView,
GridInventoryOperationResult result)
{
sourceView.ApplyInventoryTransferResult(result, destinationBoard: false);
destinationView.ApplyInventoryTransferResult(result, destinationBoard: true);
}
Show merge feedback
Merge feedback distinguishes the source stack from the target stack.
Excerpt — distinguish source and target stack feedback. Tested using public APIs.
public static void ShowMergeFeedback(
GridBoardView sourceView,
GridBoardView targetView,
GridInventoryStackMergeResult result)
{
sourceView.ApplyInventoryMergeResult(result, destinationBoard: false);
targetView.ApplyInventoryMergeResult(result, destinationBoard: true);
}
Clear temporary feedback
Clear transient channels when the interaction ends or when a new operation replaces the old one.
Excerpt — clear temporary Inventory feedback channels. Tested using public APIs.
public static void ClearFeedback(params GridBoardView[] views)
{
foreach (GridBoardView view in views)
view.ClearTransientVisuals(GridTransientVisualClearOptions.ActionVisuals);
}
Result
The structure visual represents the item, the quantity renderer adds a badge only for quantities
greater than 1, and action channels update retained render nodes without changing logical state.
uGUI interaction is optional and separate: it translates pointer input into the same actions and
operations described in the logical Inventory pages.
Troubleshooting
| Symptom | Check |
|---|---|
No badge appears above 1. |
Confirm the renderer exposes Labels and includes the quantity decoration renderer. |
| Feedback remains after an interaction. | Clear transient action visuals or replace the affected Inventory channel. |