Forum rules - please read before posting.

Grey out Inventory Items?

I am working on a cutscene that explains right clicking on inventory items to examine, I turn on the Inventory Menu and I have a notebook pulsing continuously until the player right clicks it. but there is one other item in the Inventory set to carry on start too, but Ideally I want to have that completely unclickable and the notebook not left clickable so it can't be picked up from the Inventory, only right clicked temporarily. Is that possible?

Comments

  • It is, with scripting, and so long as you rely on Unity UI for the menu.

    If you attach a Canvas Group component to the UI Button linked that the item displays in, you can use a script to set its "Interactable" property as the Menu turns on, based on some condition e.g. the state of a Global Bool Variable:

    using UnityEngine;
    using AC;
    
    public class InventoryTutorial : MonoBehaviour
    {
    
        private void OnEnable () { EventManager.OnMenuTurnOn += OnMenuTurnOn; }
        private void OnDisable () { EventManager.OnMenuTurnOn -= OnMenuTurnOn; }
    
        private void OnMenuTurnOn (Menu menu, bool isInstant)
        {
            if (menu.title == "Inventory")
            {
                bool isInteractive = GlobalVariables.GetVariable ("TutorialMode") == false;
                (menu.GetElementWithName ("InventoryBox") as MenuInventoryBox).uiSlots[0].uiButton.GetComponent<CanvasGroup> ().interactable = isInteractive;
            }
        }
    
    }
    
  • Perfect thank you Chris, I will check that out

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.