Forum rules - please read before posting.

Use inventory item with single click exception

Hi Everyone,

Might be an easy one, but Ive been stuck for a couple days. I am working with a classic adventure game-type interface "Interaction, then hotspot". I have a beer hotspot. When in the actual gameplay, the player can pick up, look at, and use the hotspot with single click. When he uses the beer, he drinks it and leaves an empty mug in its place.

However if he picks the beer up, adds to inventory, and then uses it from the inventory, the syntax will kick in and he can't use with a single click any longer. It will hold the drink rather than triggering the action and it will be "use drink with..." ... he can no longer simply use the beer with one click.

The syntax functionality as good as the vast majority of inventory items in the game will be "use with" combine items... but this one item I want to use just on its own. Any advice how tot do that? If other screenshots are required I can provide. Thanks All.

Ver: 2019.4.4f1


  • Welcome to the community, @DaveB.

    You should be able to do this by hooking into the OnInventorySelect custom event.

    First, you'll need to create an ActionList asset that selects the item, using the Inventory: Select Action, and set the asset's When running property to Run In Background.

    Then, go to the item's properties, and define a Standard Interaction for each cursor type and assign this asset file. That should make it so that, no matter what cursor is active, clicking the item will result in it becoming selected.

    You can then use this script to hook into that event, and run a separate ActionList that performs the actual drinking interaction:

    using AC;
    using UnityEngine;
    public class SingleUseInventory : MonoBehaviour
        public int itemID;
        public ActionListAsset assetOnSelect;
        private void OnEnable ()
            EventManager.OnInventorySelect += OnInventorySelect;
        private void OnDisable ()
            EventManager.OnInventorySelect -= OnInventorySelect;
        private void OnInventorySelect (InvItem invItem, int value)
            if ( == itemID)
                KickStarter.runtimeInventory.SetNull ();
                assetOnSelect.Interact ();

    Place that in a C# file named SingleUseInventory.cs, and add it as a component to your scene. If you want it to work in all scenes, you can instead attach it either to your Player prefab, or the PersistentEngine prefab to have it be spawned in automatically.

    Then just configure its Inspector - setting the "Item ID" field to the ID number of the inventory item in question, and assign the drinking interaction asset file to the "Asset On Select" field.

  • Chris, thanks for taking the time to go through this. I’ll give it a shot.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.