Forum rules - please read before posting.

[QUESTION] "While Inventory Selected" appear type problem

edited December 2020 in Technical Q&A

Hello everyone! New user here, and I hope someone can help me :smile:

I'm trying to achieve the following: I am creating the UI for the game I'm making, and I'm supposed to have a list of possible interactions on hotspots, and a different (although similar) set of interactions on my inventory Items. The general settings of my game is as in the provided image, but for the sake of being clear I'll say that I'd like to have a 2D game without character in which you can:

  • click on an hotspot and choose one of the available interactions
  • select an item in the inventory and choose one of the three possible actions (look/use/combine)

my problem is that, since the layout of the available interactions is different when you click on hotspot rather than when you choose an inventory item, I've created two different menus, InteractionUI and InventoryInteractionUI.

The former is set with Appear type "On Interaction", and everything is looking good when I press on the hotspot in the scene (I only got one for testing purposes)
The latter is set with Appear type "While Inventory Selected", but whenever I click on the inventory Item the InteractionUI menu is shown instead of the expected one, and I don't understand why. Are my settings wrong? Is an inventoryItem treated like an hotspot if I choose "Choose Hotspot then interaction" as the interaction method? Apparently I also

By the way, I'm working with the latest release of AC (v 1.72.4) on Unity 2020.1.15f. I've also took a snapshot of the inputs defined in the Input manager, because I can't seem to select the item when I click on it (the sprite doesn't change)

I'm sorry if this problem has already been solved somewhere in the forum, but I couldn't find any answer in the previous discussion (maybe I've worded my research in the wrong way, I don't know).

Any help is greatly appreciated, thank you!

EDIT: apparently the image didn't get uploaded, so I've inserted a link here: https://imgur.com/a/MAT56bj

Comments

  • Welcome to the community, @hyunkel_w.

    Is an inventoryItem treated like an hotspot if I choose "Choose Hotspot then interaction" as the interaction method?

    Exactly this. A Menu with an Appear type set to On Interaction will be turned on when you click either a Hotspot or Inventory item, and any Interaction icons you then click within it will run the appropriate interaction for that Hotspot/Item.

    An Appear type set to "When Inventory Selected** will cause a Menu to turn on only when the item is selected, i.e. the cursor has changed to that inventory item, so that you can then click on another Hotspot / item to combine it with. Selecting an item in this way is not the same as selecting it to view its Interactions - though I appreciate that can sound confusing at first.

    You shouldn't have to rely on two separate Menus for Hotspot vs Inventory interactions - at least so long as you don't need them to be totally different, stylistically.

    You have Auto-hide Interaction icons based on Hotspot / items? checked, which means that the various Interaction elements you've got listed in your Interaction menu will only show if the Hotspot or Inventory item you clicked beforehand has such an interaction. For example, "Look At" will only show if your Hotspot or item has a "Look at" interaction defined.

    apparently the image didn't get uploaded

    This forum doesn't support image hosting (see the forum rules /forum/discussion/4807/forum-rules-read-before-posting), but posting links to e.g. Imgur in the way that you have is the recommended way around this.

  • edited December 2020

    hello @ChrisIceBox,
    thank you for your reply!

    An Appear type set to "When Inventory Selected** will cause a Menu to turn on only when the item is selected, i.e. the cursor has changed to that inventory item, so that you can then click on another Hotspot / item to combine it with.

    I got confused exactly as you mentioned, although it's probably due to the fact that I can't picture in my mind a scenario in which you need a menu after you've already selected an item (a cursor change could be enough, in my opinion, but I may be a little lacking on the imagination side right now).

    You shouldn't have to rely on two separate Menus for Hotspot vs Inventory interactions - at least so long as you don't need them to be totally different, stylistically.

    This is exactly my need, and in fact I've already found a workaround for that: I create an ActionList that is run when the Interaction menu is turned on, and check if the inventory is open. If it is, I turn on the other menu instead of the Interaction one. It's a bit of a hack, but it does the job.

    You have Auto-hide Interaction icons based on Hotspot / items? checked, which means that the various Interaction elements you've got listed in your Interaction menu will only show if the Hotspot or Inventory item you clicked beforehand has such an interaction. For example, "Look At" will only show if your Hotspot or item has a "Look at" interaction defined.

    Yes, I was fiddling with the options to check if I understood the concepts correctly, and it probably remained checked although I'll probably uncheck it later (since I want to see the icon turned off when non interactable)

    This forum doesn't support image hosting (see the forum rules /forum/discussion/4807/forum-rules-read-before-posting), but posting links to e.g. Imgur in the way that you have is the recommended way around this.

    Yup, I've read the rules, but got misleaded by the image icon in the reply box, and thought that the rule was an obsolete... Apologies!

    Thank you again for your help!

  • I can't picture in my mind a scenario in which you need a menu after you've already selected an item (a cursor change could be enough)

    It's the other way around. With your interface options, clicking an item results in the Interaction menu being opened. One of those interaction icons then shown can then select the item properly when chosen - either through use of the Inventory: Select Action, or automated based on the interaction type (e.g. "Use" interactions can be made to always select an item.

    Given your interface settings though, the direct selection of Inventory items is optional. If you check Include Inventory items in Hotspot Interation menus?, then you can have relevant Inventory items appear in a list beside your Interaction icons - so that you can combine an Item with another Item or Hotspot without having to select it first. This is the same interface used by the 2D Demo, and is a case of adding an InventoryBox element of the type "Hotspot Based" to your Interaction menu.

    This is exactly my need, and in fact I've already found a workaround for that

    This would normally be best done through scripting, whereby you lock one of the two Menus according to whether a Hotspot or Inventory item has just been selected. When a Menu is locked (as opposed to just turned off), it will cease from turning on even if it's "Appear type" condition is met. If your method works, though, probably best to leave it as it is.

  • edited December 2020

    thank you for your clarification. But to be honest, I'm struggling more than I initially estimated. Right now I've experiencing this bug: whenever I hover on an Item in the inventory box, the item changes its sprite as I expect, and the interaction menu is shown (I've reverted back to the standard 2d demo and changed only the inventory menu to test things out). The interaction menu is shown correctly over the inventory Item icon, but here things start to get confusing ( see image: https://imgur.com/a/YSdfzo5)

    Basically, if I choose "USE" and release my mouse button when the cursor is still over the item, it interprets it as a click on the underlying inventoryBox (like I'm trying to use the item on itself) and deselects the item. However, if I keep the button pressed and release it outside of the item's button, I can safely choose the second item (i.e, the worm) and trigger the combine interaction.

    Can you please point me in the right direction? This is a fresh project in which I've only added AC and setted a couple of additional inputs in the input manager (EndCutscene, InteractionA and InteractionB)

    Any help is greatly appreciated!

    EDIT: i forgot to address your suggestion

    Given your interface settings though, the direct selection of Inventory items is optional. If you check Include Inventory items in Hotspot Interation menus?, then you can have relevant Inventory items appear in a list beside your Interaction icons - so that you can combine an Item with another Item or Hotspot without having to select it first.

    Unfortunately I need to uncheck this option because the required behaviour is with a direct selection of the option and the cursor change when used, and a different behaviour when combining items, so I have to tinker a bit more. Anyway, my settings are not the definitive ones, I'm just fiddling around to see if the resulting behaviour is the one that I want

  • Basically, if I choose "USE" and release my mouse button when the cursor is still over the item, it interprets it as a click on the underlying inventoryBox (like I'm trying to use the item on itself) and deselects the item.

    It looks like you're using the default "AC" Interaction menu, but a custom "Unity UI" Inventory menu - is this correct?

    This may be due to the use of different rendering (source) settings for your Menus, which both use separate ways of detecting (and consuming) mouse clicks.

    If this is the case, try switching your Inventory menu back to using AC as its Source, and/or using Unity UI for the Interaction menu. All of AC's default menus (generated using the New Game Wizard) have a Unity UI counterpart.

    If that's not the cause, can you share your Inventory manager's properties? It looks like it's been modified from the default. Also, your Use interactions are both defined - are you using an Action to select items manually?

  • thanks Chris,
    I was exactly using two different rendering settings for the Interaction menu and the Inventory one. I thought I could fix one menu at a time, since I'm learning to use AC, didn't think that it could case such an issue. Anyway, I've tried changing the rendering for the interaction menu to Unity UI Prefab and things now behave as expected.

    I'm slowly but gradually going through all your video tutorials and the manual at the meantime. Since my game is gonna be a 2D game without the player I didn't check the 3d tutorial at first, but now I know that there are some features of AC that you explore in that tutorial as well. It's nice to know that you are active in the forum as well, though, it's really helpful when I get stuck over a concept

  • No problem.

    Yes, indeed - many of the concepts covered by the tutorial videos are applicable for all game types. I also recommend the text tutorials, particularly the Interactivity section, for more help with specific areas.

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.