In this section we are going to look at how to create containers.
Our container is going to be a chest. So let’s create an actor and call it chest. We can download a chest off of the quixel bridge. Open up our chest actor and add a static mesh and inventory component. We want to apply the static mesh of the chest we just downloaded. We want to make sure the static mesh is interactable. We also want to head over into class setting and add and interaction interface as well.
Then in the interfaces tab we are going to open up the look at graph. The message will say open chest.
On the interact with tab, we are going two inventories at the same time We are going to have to create a new widget. This will a commonActivatableWidget called InventoryTwoMenus.
We are going to add a canvas panel, drag in the two inventory menus screens that have already been made. Wrap a horizontal box with a vertical box. We then are going to bring in a button to close our screen, and a spacer between our two menus as well as some padding. When done it should look close to this.
Next we are going to click on the close button and select the on-click event and copy from our main player menu we had already made and copy most of the code into our inventory 2 menu.
We then are going to have our two menus widget visible when we click on the chest.
Next we need to go to our chest and add a collision to it and under the collision settings make it interactable.
Back over in the InventoryTwoMenus screen we need to create two variables. They are the PlayerInventoryComp and the TargetInventoryComp. We then will show the inventory for each. Make both editable and expose on spawn.
Now when we load our game and open our chest after picking up the carrot we can see both inventories.
Next we are going to look at moving the item from the player inventory to storage.