Default Drop Item Handler
When a player drops an item at runtime the dropItemHandler defined for the item in our data table is what we use to spawn the item in our world. By default this handler is set to BP_Interactable_ItemPickup.
Custom Drop Item Handler
You can create your own custom drop item handlers and assign them in the data table for the item with the dropItemHandler variable. A drop item handler can be any actor blueprint. By default it will be our
To properly use a custom handler you will need to build yours to receive the information about the item, validate the request, and reward the player with the item trying to pick it up. I've included several blueprint interfaces to help cover some of these gaps. If you are new to Blueprint Interfaces you will want to read a tutorial or watch a video on the subject before you proceed.
BPI_ItemPickup
To get information about the item being dropped, and to respond to other systems that it is an item that can be picked up you will need to implement the BPI_ItemPickup blueprint interface and its functions.
setPickupItem This event will be called when your custom class is spawned. It will include the ItemRowName, ItemQuantity, and DynamicData for the item. You can use the getItem global function to get the Item details like the mesh from the ItemRowName.
isPickupItem? This function will be called when the interaction system is checking if this is a pickup item. You are expected to return true or false, along with the details that were provided on the setPickupItem call. This does not auto implement it into the included interaction system, continue below to see how that can be integrated.
BPI_InventorySystem_Interactable
If you want the included interaction system to work with picking up your custom blueprint item pickup you will also need to implement the BPI_InventorySystem_Interactable blueprint interface and its functions.
getInteractableInfo? This function will be called by the interaction system, and from it you should return if it can be interacted with, along with the label to show on the interaction widget. The player controller making the request will be passed through to you if you need it to determine the availability of the interactable.
interactWith This event is called from the interaction system when it is time to interact with your blueprint. It will include a reference to the player controller making the request. From this event you would handle whatever you need to, and then award the player with the item. Take a look at the pickupItem function in the default BP_Interactable_ItemPickup in the Blueprints/Interactables/ to see how it awards the player the items.
If you are using your own interaction system you will want to make sure you are passing a reference of the player controller making the request so your code can give the item to the proper player. The Working in Blueprint / Add Items chapter goes over giving items to the player, you should look that over in addition to reviewing how it is being handled in the pickupItem function included in the default handler BP_Interactable_ItemPickup.
Most Common Drop Item Related Questions
How do I disable dropping of items?
Navigate to your player controller and select the AC_InventorySystem component you added. On the details panel scroll to and expand the UI configuration section. Then set canDropItems? to false. By default this variable is set to true, allowing items to be dropped. By setting it to false you are disabling it.
You can also toggle this boolean at runtime for temporary disabling/enabling. However, it is not something that will be saved and persist between sessions. Restarting the game will reset the value to whatever you set as the default.
How do I disable dropping for a specific item but allow it for the rest?
Clear the dropItemHandler in the data table for the item. When this variable is null the item will not allow the item to be dropped.
It seems after dropping my item it fell through the floor?
It may have fallen through the floor. This happens if you don't set a simple collision to your mesh. To confirm navigate to and open your mesh with the content browser. Click the Show button at the top left of the viewport. Enable Simple Collision. If you do not see a green box around your mesh in the viewport you do not have a simple collision set for your mesh. If you need to you can add a simple collision right from this mesh window, use the Collision drop down on the toolbar to add one. Select the option that works best with the least amount of faces for your item shape. If you need to you can add multiple simple collisions to your mesh. Next make sure your Collision Complexity setting on the mesh details panel is set to use the Project Default.
If you still have trouble try with one of the included demo items, if it falls through the floor then it has to do with the collision settings on your floor not blocking the object type for the item pickup's mesh component, which by default is set as a World Dynamic.
If it was an item you dropped at runtime, those only last until the game restarts. There is no world persistance or respawning system for actors in this version of the asset.
I can't pickup any items at runtime.
The most likely cause is your collision configuration of your pawn is not detecting the pickup's mesh.
In the default handler we overlap the Pawn and we can override this response from the data table for our item so first make sure you didn't set it to ignore in the data table.
If you have a custom channel for your pawn make sure the response is set properly on the mesh component inside the item pickup blueprint, it should overlap. You will also want to review the buildItem function to adjust the collision override from the data table, as by default it is also set to use the Pawn channel.
If you are using a custom channel for your item pickup and you changed the default from World Dynamic you will need to add your new channel to the configuration array for the interaction system. See the InteractionObjectTypes array in the Interact section of the configuration on the AC_InventorySystem component you added to the player controller. This array is the list of channels it will use when scanning for items.
My item spawned but it is floating in the air instead of falling to the ground ...
It is most likely an issue related to your mesh's collision complexity setting. You can confirm this if the output log gave you a bunch of warnings after you stopped playing with messages like "Trying to simulate physics on".
To fix, navigate to and open your mesh. Review your Collision Complexity setting in the details for this mesh. For physics we need to use Simple and Complex.