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


Now that we've created our inventory and can show it on the GUI, let's set up a test scene and try out our new inventory.

Creating a test scene

To start off, create a new scene and name it "Chapter 4". After this, create two empty GameObjects, name one of them "Inventory" and the other one "Empty". Drag Empty to Inventory, creating a parent-child relationship. This is what your hierarchy should look like now:

Once you've done this, drag the Inventory script to the Inventory GameObject. Set the X position of Inventory Rect to 300 and its Y position to 200. Then in Inv Items, set the Size value to 9 and in Quick Items set its Size value to 4. After this, drag the Empty GameObject to the empty slot next to Empty Object in the Inspector panel. This is what the Inspector panel of the Inventory GameObject should look like now:

Once you have done this, the scene is ready to be tested. Now run the scene and press the I key; the inventory GUI should pop up on the screen. The GUI should look...