O'Reilly logo

Unity UI Cookbook by Francesco Sapio

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

Using multiple bars to make a multibar

In this recipe, we are going to create a very special kind of health bar, since we are combining multiple bars of Implementing a linear health bar type together. This may be the case when the player has to face a boss in our game who has multiple health bars. Once the player reduced one health bar to zero, there is another one behind .To achieve this, we will use multiple Image (Script) components, one for each health bar, along with a script to manage all these bars within only one health points system.

How to do it...

  1. To begin, let's create a new empty game object. Right-click on Canvas object, since we want it as a parent, and then Create Empty. Finally, rename it to MultiBar.

    Tip

    If there isn't the Canvas ...

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