Slot
Slots allow you to define areas where Game Elements can be placed, with customizable behaviors and validation rules. This system is fundamental for restricting and managing where and how objects can be anchored.
To start working with slots, add the Slot Component to your Blueprint and add a Collision Component as a child of the slot. Make sure the collision preset of the Collision Component is set to “SlotCollisionDetector”.
For a Game Element to be slotted, it must have the Slottable Component as part of its Blueprint.
Strategies
Inside the Slot Component, you must set a strategy to define its behavior. There are several strategies:
- Ghost Attach: Used for slots that hold a single element.
- Ghost Attach Adaptative: Holds multiple elements in a straight line, with a configurable direction.
- Ghost Attach Adaptative Grid: Arranges multiple elements in a grid. You set the number of rows and columns, and the grid adapts accordingly.
- Ghost Attach Adaptative Stack: Places multiple elements on top of one another.
All "Adaptative" strategies automatically distribute the available space among the Game Elements slotted into them.
Requirements
Requirements are the basis for deciding whether an element can be slotted. You can add more than one Requirement to a slot, and set the relation between them; for instance, you can make all of them mandatory, or you can simply allow slotting elements that meet one of them.
To add them, add elements to the list “Requirements”, and choose the one that fits your needs.
Here are some of the most used ones, but you can make your own; head to Technical Docs to learn how.
- Requirement Actor Tag - The Game Element must have a specific tag.
- Requirement Class - The Game Element must be of a specific Blueprint Class.
- Requirement Game Element Name - The Game Element is registered with a specific name on the GameElementsIndexGeneral table.
- Requirement Game Element Type - The Game Element is registered with a specific type on the GameElementsIndexGeneral table.
Extra Settings
- Can Interact on Empty - It allows you to point to the slot when it’s empty — useful to convey information to the player.
- Show Last Slot - It shows an icon on the slot when you grab an element from it, which disappears once you drop the element from your hand.
- Infinite Capacity - It allows adding an infinite amount of elements to the slot.
- Slot Capacity - If Infinite Capacity is disabled, it sets the maximum number of elements that can be added to the slot.
- Locked - If the slot is locked, elements can be taken from the slot but it won’t accept new ones.
- Slot Grabbing Policy - In slots with multiple elements, determines which one can be taken: the first, the last, or any of them freely.
- Slot Adding Policy - In slots with multiple elements, determines where new elements are placed: at the front, at the end, or at any position.