Displaying the battery GUI

Now that we have our battery collectables in place, we'll need to show the player a visual representation of what they have collected. The textures imported with the batteries package have been designed to clearly show that the player will need to collect four batteries to fully charge the door. By swapping an empty battery image onscreen for one with 1 unit of charge, then for an image with 2 units of charge, and so on, we can create the illusion of a dynamic interface element.

Creating the GUI Texture object

Part of the assets imported with the batteries package was the textures folder. This folder contains five image files one of an empty battery cell and the others of the four stages of battery charge. Created in ...

Get Unity Game Development Essentials now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.