Book Image

Unity Game Development Scripting

By : Kyle D'Aoust
Book Image

Unity Game Development Scripting

By: Kyle D'Aoust

Overview of this book

Table of Contents (17 chapters)
Unity Game Development Scripting
About the Author
About the Reviewers

Chapter 4. Inventory

In this chapter, we will create an inventory storage system. We'll also create a GUI representation of the inventory for the player to interact with, as well as showing the player their quick items. Items that can be quickly used or equipped using easy access keys are known as quick items; they are used frequently in RPG and FPS games. Inventories are used in many games from all genres, so having a good way to make one is very helpful.

In this chapter, we will cover the following topics:

  • Creating a storage system for GameObjects

  • Adding items to the inventory

  • Removing items from the inventory

  • Initializing the inventory

  • Setting the inventory size to be dynamic

  • Making it possible to have multiples of items

  • Setting quick items that can be used by our custom quick item inputs

  • Accessing the inventory using our custom inventory inputs

  • Displaying the inventory on screen via GUI