Performance
How does Master GPU Health Bar optimize performance?
-
Instead of nesting Unity
Image/RawImage/TextUI components in the traditional way,Master GPU Health Bardraws the whole health bar fully by one shader, including the value text. This advanced approach saves huge amounts of text mesh vertices, large amounts of UI draw calls, and UI rebuild CPU & GPU costs. -
All health bars with the same bar setting share the same single material. The dynamic runtime data is transferred through
UV2&UV3channels instead of setting material values directly. That ensures multiple health bars do not create multiple material instances. As a result, you can have 1000 health bars on screen while still costing only 1 draw call.
Exceptions that break the single-material benefit
-
Enable Avatar module: Avatar textures cannot be transferred through
UV2, so it becomes an extraRawImagechild component, which brings more draw calls depending on the overlapping rate of the bars. -
Enable Overhead Info Text: Overhead info text can be any string, so it is not possible to transfer it through
UV2as well. It is rendered as an extraRawImagechild component, bringing more draw calls depending on the overlapping rate of the bars. -
Enable Over-time Effect in Overhead Settings: Over-time effect icons listed during runtime cannot be transferred through
UV2either. They are implemented as a few extraRawImagechild components, bringing more draw calls depending on the overlapping rate of the bars. -
Multiple bar settings on the same screen: Multiple bar settings require multiple material instances, which increases draw calls depending on the overlapping rate of the bars.
With the above understanding, if you have large amounts of health bars in your game and want to maximize performance, it is recommended to:
- Disable
Show AvatarinOverhead Settings. - Disable
Show Info TextinOverhead Settings. - Disable
Show Over-time EffectinOverhead Settings. - Use the same bar setting for most health bars (it’s fine to have a few bars with different bar settings).