O'Reilly logo

Beginning 3D Game Development with Unity 4: All-in-One, Multi-Platform Game Development, Second Edition by Sue Blackman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 14

image

Managing the Inventory

Having taken care of most of the preliminary setup for your inventory system, in this chapter, you will be adding the code that handles its onscreen presentation and layout. Because an array of all the objects currently in inventory is key to the task, you will be adding most of the inventory-related code to the GameManager script, so it can be easily accessed.

Organizing the Inventory Objects

To start, let’s add an internal array to hold the objects. Because it will be constantly growing and shrinking, it would be nice to be able to use a JavaScript type array. But because JavaScript arrays are dynamically typed, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required