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.
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.
Now, right-click on Multibar and add a new image by selecting UI | Image, and again rename the object just created as...