Unity realizes the effect of delayed blood deficiency and blood loss buffer

The effect of using the material
https://github.com/zheyuanzhou/Youtube-Unity-Tutorial/tree/master/EP45_Health%20Bar/Sprites
is shown in the figure below:
insert image description here
first create a new Canvas in the scene, and name it HeathBar, and create Three images are used as the sub-objects of the former, and they are respectively named bg (empty blood bar background), Effect (buffer effect when showing "blood loss"), and HP (display blood volume). And place the latter under the former in the order described above; as shown in the figure below, the levels of the three should be as shown in the figure below (the 3D view is used for better illustration, the actual project is still
insert image description here
2D):
insert image description here
Assign the material to the bg, Effect, and HP Image components under HeathBar and set them as follows:

For the Image component of bg, check Preserve Aspect to use the original length ratio of the image

Guess you like

Origin blog.csdn.net/qq_36303853/article/details/130762359