bool bCanAdd = InventoryComponent->CanItemGoInContainer(ItemInstance);Override in Blueprint to implement custom logic:
Event Can Item Go In Container
Item Instance: [Input]
↓
[Check item tags]
↓
Return: true/false
Configure restrictions for individual slots using FContainerSlotSettings:
struct FContainerSlotSettings
{
bool bRestrictSlot; // Enable restrictions
FGameplayTagQuery RestrictionQuery; // Tag query filter
TArray<FName> EnabledItems; // Whitelist
TArray<FName> DisabledItems; // Blacklist
};Example: Weapon-Only Slot
Blueprint (in InventoryComponent):
Slot Settings:
[0]:
Restrict Slot: true
Restriction Query: Has Tag "Item.Category.Weapon"
Enabled Items: []
Disabled Items: []
Example: Whitelist Specific Items
Slot Settings:
[0]:
Restrict Slot: true
Restriction Query: None
Enabled Items: [HealthPotion, ManaPotion, StaminaPotion]
Disabled Items: []
Only those three specific items can go in this slot.
Example: Blacklist Quest Items
Slot Settings:
[All Slots]:
Restrict Slot: true
Restriction Query: Not Has Tag "Item.Category.Quest"
Enabled Items: []
Disabled Items: [QuestItem_SpecialKey]
Quest items cannot be placed here.
Before adding an item:
bool bCanAdd = InventoryComponent->CanItemGoInSlot(ItemInstance, SlotIndex);
if (!bCanAdd)
{
// Show error message
ShowNotification("This item cannot be placed here");
}