Skip to main content

Performance


How does Master GPU Health Bar optimize performance?

  1. Instead of nesting Unity Image / RawImage / Text UI components in the traditional way, Master GPU Health Bar draws 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.

  2. All health bars with the same bar setting share the same single material. The dynamic runtime data is transferred through UV2 & UV3 channels 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 extra RawImage child 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 UV2 as well. It is rendered as an extra RawImage child 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 UV2 either. They are implemented as a few extra RawImage child 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:

  1. Disable Show Avatar in Overhead Settings.
  2. Disable Show Info Text in Overhead Settings.
  3. Disable Show Over-time Effect in Overhead Settings.
  4. Use the same bar setting for most health bars (it’s fine to have a few bars with different bar settings).