Player Controller And Character
Player Controller
Open the ALS_Player_Controller.
Add two components to it: Inventory HUD Component and Inventory.
Configure the inventory parameters: Specify unique identifier (it will be used by the save and load system). Also, define its size and the size of temporary slots if you intend to use them.
Now, add the function call Open Inventory
from the Inventory HUD Component to any key. In the example, I
chose the key
"B" because in this Player Controller other keys are already assigned, but you can reassign them.
Now you can launch the game and open the inventory.
Character
Find the class ALS_AnimMan_CharacterBP and create a child from it. This is desired to avoid mixing the logic of bots and the player.
Name the new class as you wish, and then open it.
Add the Notes Component and Player Interaction Component to this character.
Also, if you are going to use the camera from ALS, you will have to add a Camera component to the character.
Add a Box Collision Component.
Set the collision so that it covers the area where items can be highlighted. The display range of widgets is configured in the Player Interaction Component, so this area should be slightly larger.
Using the components we added, repeat this logic on the Event Tick.
Now assign a key to interact with Items.
Remove the character from the scene, otherwise this whole thing won't work.
Add Player Start to the map.
Open ALS_GameMode_SP and in the Default Pawn field, add our inherited character.
Make sure that the World settings are also set to this character.
You can now start the game and interact with items. How to add new items: Create New Inventory Item / Add Pickup Item
If you need references for the Inventory HUD Component and Inventory in your character, which are in the player component, then add two interfaces to your character: Add Interfaces.
After adding interfaces, you can set up item drops so that it appears in front of you after removal: Drop Item.