© Jared Halpern 2019
Jared HalpernDeveloping 2D Games with Unity https://doi.org/10.1007/978-1-4842-3772-4_6

6. Health and Inventory

Jared Halpern1 
(1)
New York, NY, USA
 

This chapter is a big one. We’ll tie everything we’ve learned so far together to build a health bar to track the players’ hit-points. Besides leveraging Game Objects, Scriptable Objects, and Prefabs, we’ll learn about some new Unity component types, such as the Canvas and UI Elements.

No RPG would be complete without an inventory system, so we’ll build one, along with an on-screen inventory bar that will display all the objects the player is holding. This will be an intense chapter, with lots of scripting and prefabs, but by the end of it you’ll feel much more confident in building ...

Get Developing 2D Games with Unity: Independent Game Programming with C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.