Interaction System
Use the interaction system when a player should pick up an Item, open a chest, enter a Shop, or use a crafting station. The same three-part flow supports each outcome: an Inventory Interactor represents the player, an Interactable marks a world object, and an Interactable Behavior performs that object’s action.
How an interaction runs
- A player Collider or Collider2D enters the trigger on an Interactable.
- Interactor Layer Mask checks the layer of the GameObject carrying that player collider.
- The Interactable finds an
IInteractoron that GameObject or one of its parents and adds itself to the interactor. - The standard Inventory Interactor selects the first registered Interactable and can show its Interactable Indicator.
- The Inventory Interactor’s Input, or an enabled Auto Interact option, requests the interaction.
- The Interactable invokes its UnityEvent and named event. Its Interactable Behavior then picks up an Item, opens a menu, or performs another outcome.
- Leaving the trigger removes the Interactable. If it was selected, the next registered Interactable becomes selected.
The standard Version 1 Inventory Interactor does not rank targets by distance. When triggers overlap, it interacts with the first target in its list. Keep interaction triggers distinct when the player must have an unambiguous choice, or derive a custom Inventory Interactor when the project needs another selection rule.
Set up the player
- Select the player GameObject that owns the Inventory.
- Confirm that the same GameObject has a concrete Opsive player-input component and add Inventory Interactor. The Main Manager’s Character Setup can add the standard UIS character components.
- Assign Inventory, or leave it empty when the Inventory is on the same GameObject so the component can find it at startup.
- Assign an optional Interactable Indicator such as a prompt. The Inventory Interactor keeps it hidden until at least one Interactable is in range.
- Leave Auto Interact disabled for a button-driven player.
- Expand Input. The released Version 1 default is Input Type: Button Down and Input Name: Action. The old Standard Inventory Input component is not required by the current Inventory Interactor.
- Ensure that the player has the Collider or Collider2D needed to enter the target’s trigger. Configure Unity’s Rigidbody and collision-layer requirements for the project’s 2D or 3D physics setup.

The Input name is resolved by the player’s IPlayerInput implementation. Complete the input setup if Action is not reaching the Inventory Interactor.
Set up a world object
- Add a Collider or Collider2D to the world object and enable Is Trigger.
- Add Interactable to the same GameObject.
- Set Interactor Layer Mask to include the layer used by the player’s entering collider. It defaults to Everything; narrow it when only particular actors should interact. A collider on a child GameObject must use an included layer too.
- Leave Is Interactable enabled.
- Enable the physics mode the target uses. 2D accepts 2D trigger events and 3D accepts 3D trigger events; both are enabled by default.
- Leave Auto Interact disabled when the player should press the Inventory Interactor’s configured Input.
- Optionally connect On Select, On Deselect, and On Interact UnityEvents for presentation that does not belong in the outcome behavior.

Choose one automatic-interaction location:
| Desired result | Inventory Interactor Auto Interact | Interactable Auto Interact |
|---|---|---|
| The player presses the configured Input | Off | Off |
| This player automatically uses every target it enters | On | Off |
| This particular target runs as soon as it is selected | Off | On |
Keeping only one automatic path active makes the trigger behavior easier to reason about.
Add the outcome behavior
Attach one concrete Interactable Behavior beside the Interactable. The base behavior supplies these shared choices:
| Inspector field | Released Version 1 default | Use |
|---|---|---|
| Deactivate On Interact | On | Removes the target from the interactor and deactivates its GameObject after the outcome runs. Disable it for a reusable Shop or crafting station. |
| Schedule Reactivation Time | -1 |
A positive value reactivates a deactivated target after that many seconds. A value of zero or less does not schedule reactivation. |
| Select Indicators | Empty | Activates the assigned GameObjects while this target is selected and hides them when it is deselected. |
Use the behavior that matches the outcome:
| Outcome | Components beside Interactable | Important configuration |
|---|---|---|
| Pick up a Health Potion | Item Object and Item Pickup | Set the Item Object to Health Potion. Add To Item Collection defaults to the Main purpose, which can be the player’s Bag. Enable Fail If Full Amount Does Not Fit—off by default—only when a partial pickup should be rejected. |
| Open a Shop | Menu Interactable Behavior and Shop Menu Opener | Disable Deactivate On Interact. Assign Menu Opener, set Panel Name to the Shop Menu’s unique name, and assign Shop. |
| Open a crafting station | Menu Interactable Behavior and Crafting Menu Opener | Disable Deactivate On Interact. Assign Menu Opener, set Panel Name to the Crafting Menu’s unique name, and assign Crafter. |
| Open a chest | Chest Interactable with the chest setup | Assign the Chest or a GameObject implementing IChest. The behavior passes the player’s Inventory to the chest and makes the target unavailable while the chest is open. |
Menu Interactable Behavior enables Use Player ID As Panel Manager ID by default. With that option enabled, the opener uses the InventoryIdentifier.ID from the interacting player’s Inventory GameObject to find the matching Display Panel Manager. This supports the correct player-owned UI in setups with more than one panel manager. Disable it only when the opener’s fixed Panel Manager Index, which defaults to 1, is intentional.
For example, a Shop selling Health Potion should have an Interactable and trigger on the shopkeeper object, a reusable Menu Interactable Behavior, and a Shop Menu Opener connected to that Shop. The interaction supplies the player’s Inventory to the Shop Menu; the Shop remains responsible for its Items, Gold prices, and transactions.
Editor checkpoint
Before entering Play Mode, confirm that:
- the player has Inventory, Inventory Interactor, a concrete Opsive input component, and a collider, plus Inventory Identifier when a menu interaction uses the player ID;
- the target has an Interactable, a trigger collider, and one outcome behavior;
- Auto Interact is enabled only where the chosen interaction style requires it;
- a pickup has a valid Item Object and destination Item Collection;
Verify in Play Mode
- Approach a Health Potion pickup. Confirm that its Select Indicators and the player’s Interactable Indicator appear only while the pickup is in range.
- Press
Action, or enter the trigger when using Auto Interact. Confirm that Health Potion enters Bag and the pickup deactivates or is destroyed according to its behavior settings. - Leave and re-enter a reusable target. Confirm that Select and Deselect presentation resets correctly.
- Approach the Shop and interact. Confirm that the Shop Menu opens for the approaching player’s Inventory, shows the expected Shop Items, and can complete the Gold transaction.
- If two target triggers can overlap, enter them in both orders and confirm that the default first-registered selection is acceptable.
Troubleshooting
| Symptom | Check | Fix |
|---|---|---|
| The target is never selected | The trigger collider, 2D/3D switch, and Interactor Layer Mask | Enable the matching physics mode, verify Unity’s trigger setup, and include the exact layer of the entering player collider. |
| The prompt appears, but pressing the button does nothing | Inventory Interactor Input and the player’s IPlayerInput component |
Keep Input Type at Button Down, match Input Name to the configured action, and complete the project input setup. |
| The target runs immediately | Auto Interact on both the player and target | Disable both for input-driven interaction, or keep it enabled only on the intended side. |
| The wrong nearby target runs | Overlapping interaction triggers | Resize or reposition the triggers so the intended target registers first, or implement a custom Inventory Interactor selection rule. |
| A pickup does not enter the Inventory | Item Object, Add To Item Collection, capacity, and Fail If Full Amount Does Not Fit | Assign a valid Item, target an existing collection such as Bag, and choose the partial-pickup rule that matches its capacity. |
| A Shop or crafting interaction does not open a menu | Menu Opener, Panel Name, player Inventory Identifier, and panel-manager index | Assign the matching opener and data source, use the panel’s exact unique name, and make its Display Panel Manager index match the selected player ID or fixed index. |
| A menu target disappears after one use | Deactivate On Interact on Menu Interactable Behavior | Disable it for a reusable menu interaction. |
Related:
- Input explains the player-input implementation and Unity EventSystem setup.
- Input handlers compares Inventory Interactor with the other UIS input handlers.
- Item pickups covers Item, Inventory, Currency, and random pickups.
- Shop configures the Shop, Gold prices, Shop Menu, and transactions.
- Crafting connects Crafting Recipes, a Crafter, and the Crafting Menu.
- Chest Menu explains the standard chest-to-player Inventory flow.
Extend the interaction API
InventoryInteractor implements IInteractorWithInventory, which extends IInteractor with an Inventory property. Interactable implements IInteractable, including CanInteract, Select, Deselect, and Interact. Implement those interfaces directly when a custom object cannot use the standard components.
For a custom outcome on a standard Interactable, derive from InteractableBehavior and implement OnInteractInternal. Keep the developer-specific work after the standard selection and trigger setup:
using Opsive.UltimateInventorySystem.Interactions;
public class ExampleInteractableBehavior : InteractableBehavior
{
protected override void OnInteractInternal(IInteractor interactor)
{
if (!(interactor is IInteractorWithInventory interactorWithInventory)) { return; }
var inventory = interactorWithInventory.Inventory;
// Apply the project-specific outcome to the Inventory.
}
}
Override CanInteract to reject an interaction, or override OnSelect and OnDeselect for additional presentation. Call the base selection methods when the inherited Select Indicators should still work.
The Interactable also invokes these named events on its GameObject, each with the current IInteractor argument:
EventNames.c_Interactable_OnSelect_IInteractorEventNames.c_Interactable_OnDeselect_IInteractorEventNames.c_Interactable_OnInteract_IInteractor
Register and unregister matching handlers over the same Unity lifecycle, as InteractableBehavior does in Start and OnDestroy.