This version of the asset uses the Enhanced Input System to handle a lot of the various inputs throughout it.
You can find everything for the inputs in the Blueprints/Input/ folder. At the base of this folder is the IMC_InventoryItemSystem , this is the mapping context for all input actions related to the system. It is applied to the Player Controller’s EnhancedInputLocalPlayerSubsystem on the start of begin play inside the AC_InventoryItemSystem. It is given a priority of 10, so if one of your own inputs stops working this is why.
This version of the asset is the first to offer Gamepad Support. A special thank you to everyone who has been patiently waiting for this update. There are a few limitations and things to keep in mind:
- There are a lot of moving parts, which means there might be some bugs. If you find a bug please let me know so I can get it resolved.
- My development device for gamepad support was limited to an Xbox Controller. If you use a controller that is giving you trouble please let me know.
- Extra code was added to navigate within the inventory grids, as well as move items around within the inventory and move the inventory window itself.This added overhead is client side only and contained within the UI so it shouldn’t cause any performance issue.
- Currently there is no way to show the custom drop amount window, with a gamepad you will have to split the stack first before dropping it.
- The fraction splitting options on the vendor sell panel are hidden when using a gamepad, there were just not enough gamepad buttons to account for them all.
- Currently all Gamepad, Mouse and Keyboard Input Actions are combined into the one IMC_InventoryItemSystem, this is for your convenience. You will most likely want to split them up based on device, or port them into your own enhanced input mapping contexts. If you do end up moving them all out of this mapping context make sure you remove the code that is attaching the enhanced input mapping context.
When you open a window with the gamepad the focus will be set to that window. Navigating the windows is done using the D-Pad. To switch focus back and forth from the open window to the inventory hit the IA_Gamepad_FocusSwitch button. The primary action for the currently focussed window can be triggered using the IA_Gamepad_FocusWindow_PrimaryAction. Additional actions within the window are mapped to additional input actions.
Some inputs that are specific to mouse such as drag and drop and clicking behaviors still exist, and will need to be changed manually through the UI blueprint being interacted with as they are not handled the same way as a normal input event but instead are using the blueprint overrides. For these particular instances an additional input action has been added in this version to support the functionality on a gamepad. This is why you will see some input actions with only a gamepad binding associated to them.
Here is a list of all the various InputActions, the default bindings for each can be viewed and changed by opening the IMC_InventoryItemSystem in the Blueprints/Inputs folder and expanding the input action. To see where they are being used in the project use the “Find in Blueprints” under the tools menu in your editor and search for the input action name.
IA_ModifierShift This is how we detect when the shift button is pressed.
IA_ModifierCtrl This is how we detect when the ctrl button is pressed.
IA_ModifierAlt This is how we detect when the alt button is pressed.
IA_Gamepad_FocusSwitch Uses a flip flop to switch the focus between the open window and the player inventory.
IA_Gamepad_Nav_Up Navigate the focus window up from the current focus point.
IA_Gamepad_Nav_Down Navigate the focus window down from the current focus point.
IA_Gamepad_Nav_Left Navigate the focus window left from the current focus point.
IA_Gamepad_Nav_Right Navigate the focus window right from the current focus point.
IA_Gamepad_FocusWindow_PrimaryAction Performs the primary expected action for the focused window and item.
These gamepad input actions are also available but not currently used by the IMC_InventoryItemSystem as they seemed redundant to the FocusSwitch:
IA_Gamepad_FocusInventory Force the focus to the inventory.
IA_Gamepad_FocusWindow Force the focus to the open window.
IA_Gamepad_HideFocusWindow Hide the focus window.
IA_InventoryToggleUI Toggle showing and hiding the player’s inventory window. If held down for longer than one second with a gamepad it will activate the Inventory Window’s move mode. Hitting the button (including a short press) again will deactivate the move mode.
IA_InventoryResetPosition This will reset the inventory window to the center of the screen.
IA_InventoryItemUseEquip Will attempt to use or equip the currently selected item.
IA_InventoryItemDrop Will drop the currently selected item.
IA_InventoryItemTransfer Will transfer the currently selected item to and from a transferable target like storage and banker to and from the player’s inventory.
IA_InventoryItemSplit Will show the split stack window for a stack of items.
IA_InventoryItemMove This will activate the inventory item move mode on the gamepad, where you can move an item from one slot to another using the D-Pad.
IA_InteractClosestNearby Interact with the closest nearby interactable (BP_Interactable). If a window spawns from this interactable and you are using a gamepad the focus will change to this window. You can close the window that opens by pressing the button again.
IA_InteractPickupEverything Will attempt to pick up all items near the player that can be picked up.
IA_HotbarHide Hide the hotbar, can be used when you want to hide the UI for a screenshot. While hidden the hotbar will still work.
IA_HotbarShow Show the hotbar.
IA_HotbarRemoveFromSlot Remove the item in the selected hot bar slot and put it back in the player’s inventory using a gamepad.
IA_HotbarSelectNextSlot Will select the next slot going from left to right. By default no slots are selected so the first call of this will select the first slot.
IA_HotbarSelectLastSlot Will select the last slot going from right to left. By default no slots are selected so the first call of this will select the very last slot.
IA_HotbarSelectSlot 1,2,3 … 9] - Will select the specific slot. Remember slots start at 0 even though you will probably start at 1 for the key binding.
IA_EquipmentToggleUI Will show or hide the equipment tab.
IA_EquipmentPrimaryAction Will perform the primary action of all equipped items. Most often used as the main attack.
IA_EquipmentSecondaryAction Will perform the secondary action of all equipped items. Most often used a secondary attack.
IA_EquipmentJumpAction Will perform the jump action of all equipped items. In the demo world the rocket boots use this.
IA_CurrencyToggleUI Will show and hide the currency tab using a gamepad. The inventory must be open for this to work. Using a mouse click the currency widget at the bottom of the inventory.
IA_CurrencyToggleDropUI Will show the drop currency UI using a gamepad. SHIFT+Left click a currency using a mouse.
IA_VendorNextTab Will cycle the tabs between the buy and sell window. Use the gamepad navigation to navigate and the
IA_LootAll Will loot all items currently visible in the loot window.
IA_RecipeQuantityMax Will set the crafting quantity to the max possible based on the current ingredients found in the player’s inventory.