Forum rules - please read before posting.

Inventory Control Not Working with Keyboard/Controller

Hi again,

After fixing the Hotspot detection and NavMesh issues for keyboard/controller, I implemented the dynamic input switching script from the wiki.

I tweaked it slightly to better suit my setup, here’s the version I’m using.

Now I’m trying to get Inventory control working with keyboard/controller, but haven’t had much luck so far. I recorded a short video to show what’s happening:

🎥 Watch the video here.

I’ve searched through the forums and tried a few things, but still couldn’t get it to behave as intended. What I’d love is a simple, working control scheme for:

  • Opening the inventory
  • Cycling between and selecting items
  • Merging items
  • Dragging items onto scene hotspots

And later on, for navigating menus with keyboard/controller as well.

Could you please take a look and let me know what I might be missing, or if there’s a tutorial that could guide me?

Thanks so much in advance! 🙏 :)

Comments

  • edited June 28

    Setting up your interface for working with a keyboard/controller only is quite different than the mouse.

    What I'd recommend is to first figure out all the changes - across each of the Managers - you want to make to get this input/movement style working as intended, and only then deal with a script that changes these settings dynamically.

    For the Inventory menu: you've got its Appear type set to Mouse Over, which won't be used when navigating directly.

    To have it react to the Inventory key, either set it to On Input Key, or Manual and use Active Inputs to turn it on/off when the Inventory button is pressed. The Manual's "Navigating menus directly" chapter covers how to move between elements with a keyboard/gamepad.

    You may also want to have a separate Menu that just shows the selected item in a UI rather than over the cursor. You can do this with an InventoryBox element of the type "Display Selected".

  • Thanks so much for your time and help, Chris, really appreciate the guidance!

    I tried to carefully follow everything you mentioned. I set the Inventory menu to appear on input key and checked the manual’s section on navigating menus directly.

    The issue now is: I can open the Inventory, but I can’t seem to select or cycle through any items, and I doubt drag-and-drop would work either in this current setup. Something still feels off.

    I recorded a clearer video showing everything in more detail, including how the UI behaves.
    👉 Here’s the video

    If you get a chance to check it, I’d really appreciate your insight. My guess is that it might be related to using a Unity UI prefab setup, maybe I missed a step there?

    Thanks again, and looking forward to your thoughts! :)

  • Your Menu is set up to auto-select ShiftLeft by default, as that's the first element listed. Uncheck Auto-select first visible Element? and set First selected Element to InventoryBox.

    I doubt drag-and-drop would work either in this current setup.

    You can have drag-and-drop work with a keyboard/gamepad, but it requires the use of the simulated cursor - rather than navigating menus directly. Is that what you're aiming for?

  • YES!!! It's working now! B)
    I guess this was the culprit "set First selected Element to InventoryBox".
    I thought this option will auto-select first inventory item :D
    So maaaaaaaaany thanks for the accurate guiding! <3
    Also drag-and-drop is working out of the box already! Just had to add CursorVertical and CursorHorizontal to input manager and tweak the sensitivity speed! B)

    Just one last question, with using Keyboard or Controller, when I press Escape (opens Pause menu), I can navigate easily between buttons. But when I start the game, at Main Menu (Title Menu), I have 3 buttons, looks like keyboard or controller, doesn't work there. Only Mouse working. I noticed "Pause" menu have a ActionList and also "Pauses Game?" is checked. I did this on Title Menu, and it did the trick but whole screen behind is paused, is there a way to fix this? (I have a animated scene behind).

    Thaaanks again! :)

  • You can either have the animation play while paused by setting its Animator's Update Mode to Unscaled Time, or by running the Engine: Manage systems Action to allow direct-navigation of Menus during gameplay.

  • edited July 1

    Awesome, thank you again Chris! 🙌
    Direct navigation works like a charm now, loved how clean that solution was. Appreciate the quick and clear reply as always.

    One more quick thing! The current inventory setup works fine (as you can see in my video), but I was just curious >:) , is it possible to implement a slightly more user-friendly flow like this?
    📹 [Recorded a short clip from another game to show the idea]

    -Showing animated hostspot icon when character is near hotspot
    -Selecting inventory items with buttons (without cursor, drag and dropping)
    -Opening inventory when not near hotspot, selected inv come in corner (this is not mandatory)

    If you could just point me in the right direction or let me know if it’s doable within AC’s system, I’d love to explore it.

    Thanks again! 😊

  • I'm afraid I'm a little confused by your intent here.

    There's no drag-and-dropping in the second video - it's all done through direct-navigation of menus, with no cursor. Are you looking to use the simulated cursor to select / drop items as you are now? Drag-and-drop requires a cursor (either simulated or mouse).

    Showing animated hostspot icon when character is near hotspot

    You can configure a Hotspot icon in the Settings Manager that can be animated if each of its frames in the same texture.

    For more control, you can instead create a Menu with an Appear type and Position type set to On Hotspot.

    • Selecting inventory items with buttons (without cursor, drag and dropping)
    • Opening inventory when not near hotspot, selected inv come in corner (this is not mandatory)

    To clarify: the same input button would open the Inventory menu when near/far from a Hotspot, but if you're near a Hotspot then you automatically use the selected item with the Hotspot?

    I recall another user recently asking about this, though I can't find the thread.

    Firstly, you'd need to set up to use "Player Vicinity" Hotspot detection, to do away with the need for the cursor. Then, a custom script would need to be implemented that overrides the behaviour when clicking Inventory items - either selecting them for later use, or using them on the Hotspot if nearby.

  • Thanks a ton again, Chris, really appreciate the time, care, and detail you always put into your replies 🙏

    I tried a few tweaks and explored some setups based on your suggestions, but I think I’ll stick with the current approach: controlling the cursor with keyboard/joystick. It’s working fair and square for us, and honestly, I couldn't even imagine we’d get this far! :) We're more than satisfied with how things are functioning now.

    Since we already have an Input selection menu at the start, managing the whole game this way feels more viable and future-proof. Even if a few mini-games require cursor interaction, we can comfortably control it with joystick or keyboard.

    Also, using a "Flash Hotspot" system as a visual replacement for the standard hotspot icons works perfectly for us, especially since we can customize it per hotspot instead of applying it globally. That added flexibility helps a lot with polish.

    With the new Unity Input System in place, I feel confident that even devices like Steam Deck or Switch controllers will work smoothly later down the line. I just have to implement a simple touch support (like one tap or double tap) to make it even more universal across platforms.

    Thanks again for all your support, this has been a blast so far! B)

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.