Inventory System

Preface
This article was prepared for internal test users. Everything in this article does not represent the final quality.
InventorySystemComponent
First Add GIS_InventorySystemComponent to your character.
Then, you can add many item collections to collision lists.
You should associate a GameplayTag to identify each collection. GIS.Collection.Main is required and will be used as default collection.
Item Collection
An inventory can contain a large number of item collections.
How many collections are needed depends on your own game design.
Commonly in a game, there will be several places to store a range of items, such as backpacks, belts, weapon bars, and equipment bars. Each of these can be considered as an item collection.
Type of Item Collection
Normal Item Collection
To store a regular list of items, you should use item collection.
It's suitable for simple item storage, like loot boxes, or anything belonging to a NPC. It also works for players if you don't need complex data management.
Item Multi Stack Collection
This type of collection allows you to split items into multiple stacks.
It can specify the max size for each stack, 99 is a normal choice.
Let's say you have a multi stack collection with 99 as size limit for each stack. If you have 100 apples, you will have to use 2 stacks to store all apples, one stack contains 99 apples, and another stack contains only 1 apple.
Item Slot Collection
This type of collection is usually used for store equipment items, and requires a GIS_ItemSlotSets(Data Asset) to define available slots for this collection.
For this collection, you normally want to put items which can be stacked(equipments)
GIS_ItemSlotSet
Here is an example of the item slot set.
Each slot you can add
Default items
For each collection, you can add default items to collection via DefaultLoadOut.
Access collection
You can access different collections with these APIs, then use collection references to access item stacks within them.
Item Guide
Creating item definition
You create an item by creating a new data asset of type GIS_ItemDefinition.
Here is an example.
You can associate any tags to an item to represent the trails of this item.
Unique Item
Unique Item: If you enable unique option in Item Definition, then when you add this item to collection with an amount of 100, it will generate 100 unique item instances with unique uuid.
Normally, only weapons should be unique.
Unique items can not be stacked.
Item Fragemts
You can also add many item fragments to attach different data to item definition, and you can call FindFragementByClass to get item fragment data from item definition.
For iteminstance created at runtime, you can also directly find fragments from iteminstance and then get fragment data.
Custom item fragement
You can make a subclass of GIS_ItemFragment to create a new type of item fragment class. It will auto popup in fragments dropdown of the item definition.
And you can add any data you want to fragment class and make it public so it can be configured from outside.
You can also override "OnItemInstanceCreated" so you can apply your static data to item instance.
Manage item instances with inventory components.
Manage item with inventory
Add item to inventory
When you add an item to inventory by item definition, you create a new item instance.
When you add item instance to inventory, you operate on existing item instance (For example, move item to different stack in same collection or swap data between different collections.)
Remove item from inventory
When you remove item by definition, you remove certain amount of item instances associated with this definition across all item collections inside of this inventory.
Access item from inventory
When you access item instance from inventory, you are accessing it from certain collection.