Creating a Canvas

Create a new canvas inside Unity: Main Menu > GameObject > UI > Canvas
This will automatically create an Event System, that is required when working with UI.

Create an empty game object as a child of the canvas and setup the size. To create an empty game object, select the canvas in the Hierarchy > Context Click > Create Empty

Customize Visuals

Now you can customize the visuals of the inventory. For example you can create a background image as a child of the inventory game object.

Add ItemContainer component

In the next step we need to attach the ItemContainer component to our inventory game object. Select the inventory game object and attach the ItemContainer component from the Main Menu > Tools > Unitycoding > Item System > Components > ItemContainer or click the Add Component button in the Inspector.

Add an ItemCollection component to be able to store items.

Field Description
Name Enter a name of the container to be able to find it using
Priority Organize your containers by priority. ItemContainer.AddItem(name,item);
will try to add the item to the container with highest priority first.
Key Code Setup a KeyCode to show and hide the window.
Ease Type Animation easing type.
Duration The duration of the animation.
Show Sound SoundClip to play when the window is shown.
Close Sound SoundClip to play when the window is closing.
Focus Brings the window to front.
Deactivate On Close Disables the gameobject when the window is closed. Increases performance
because the window does not need to redraw when the canvas is dirty.
Use Button Which button to should be used for item use events?
Dynamic Container Create slots at runtime.
Use Reference Set this container to be a referenced container. Mostly used for Actionbars.
Can Drag In Can the user drag items into this container?
Can Drag Out Can the items be dragged out of this container?
Can Drop Items Set if the items can be dropped from this container to world.
Can Reference Items Set if you can reference items from this container.
Can Sell Items Set if the items can be sold from this container.
Can Use Items Set if the items can be used from inside this container.
Use Context Menu Should Context Menu be used? Requires the Context Menu widget.
Show Tooltips Should tooltips be displayed?
Move Used Items Move used items to the given containers.

Creating Slot

Now we can create a grid for the slots. Create a new game object as a child of the inventory and attach the GridLayoutGroup component to it through the Main Menu > Component > Layout > Grid Layout Group. The Cell Size is the size of your slots.

In the next step we can create the slots for our container. Create a Button through selecting the grid game object in the Hierarchy > Context Click > UI > Button and attach the ItemSlot component to the button through the Main Menu > Tools > Unitycoding > Item System > Components > ItemSlot.

You can now create optionally child components for the ItemSlot. The icon image will be set when an item is added to the slot, you can define the icon of the item in the Item Editor. The overlay field is a filled image, which will be updated with the cooldown progress. When creating the child components don’t forget to reference them in the ItemSlot.

Now that your slot is finished you can duplicate it to have multiple slots in the container.

Create Item
Pickup Items