I have a simple health system where the player can take a set number of hits before dying. The player is able to choose how many hits they can take and I would like to be able to reflect their choice in the health bar.
Right now my health bar is a single image that shrinks from right to left as the player takes damage (see below). I would like to instead visualize the number the player chooses with each hit point as a separate block. As the player takes damage the right-most block would disappear.
I think that what I need to do is get the health number the player has selected in Start and then instantiate the correct number of child objects inside my container, but the width and spacing of each would need to be based on the number chosen by the player.
Does anyone know how I go about adding the child blocks in the correct positions and with the right widths and spacing?
Hopefully the image below illustrates what I have now and what I am trying to achieve:

