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 ...

Get Unity UI Cookbook 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.