Forum rules - please read before posting.

Inventory Interactions & Menu

I am currently working on a 2D game project, and I've encountered the need for specialized interactions with certain inventory items.

I've set up an 'InventoryItemCloseUp' Menu to display an enlarged version of my inventory items. This functionality is assigned to the Examine interaction for most of my inventory items. Consequently, when a player selects an item's icon within the Inventory Menu, it triggers the display of this larger item representation.

However, my project requires certain inventory items to initiate a unique series of actions upon interaction. More explicitly, after a player clicks on an item in the Inventory Menu and sees the enlarged item, clicking on a specific part of this UI should trigger a predetermined sequence of events.

To manage this thus far, I have created separate Menus for each of these unique inventory items, instead of assigning the 'InventoryItemCloseUp' Menu for their 'Examine' interactions. This approach has led to an extensive amount of menus in my project. I am starting to wonder if there might be a more efficient method to accomplish this task.

I would be immensely grateful for any advice or suggestions that you could provide on this matter. Thank you very much in advance.

Comments

  • Presumably, each of the "clickable locations" on these items are in different places? If you can share screenshots of a typical item, it'll help me get a more exact handle on the situation.

    There's a couple of main ways you could go about this.

    One way would be to condense all into a single Menu, with each clickable location being a sepearate Button element that's shown/hidden accordingly at the time the Menu is turned on.

    This could be done with scripting to ease the number of Actions needing to be run at the time. To control the visibility of a given Menu Element:

    AC.PlayerMenus.GetElementWithName ("MyMenu", "MyElement").IsVisible = true/false;
    

    The complexity of this approach, though, is tied to the number of items/interactions to have to deal with.

    The other approach would be to rely on individual prefabs that replace the Close-up Menu.

    Inventory items can have an "Associated prefab" assigned in their Inspector, which you can then spawn in the scene using the Inventory: Scene Item Action.

    Here, you could either create a regular 2D/3D prefab with Hotspots, styled to look like a Menu, and have it position in front of the camera upon spawning, or create a Unity UI Canvas prefab and just use regular Buttons. You wouldn't be able to use AC's Menu system here, but you can still have Unity UI Button components call AC ActionList assets when clicked by having them invoke the asset's "Interact" function in their On Click event.

  • Thank you so much for your response, Chris! Yes, each of the clickable locations on the items are in different places.

    I plan to delve into your suggestion of managing visibility with AC.PlayerMenus.GetElementWithName ('MyMenu', 'MyElement').IsVisible = true/false; first. Thank you once again for your time!

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.