Skip to main content

Home/ abitgames/ Group items tagged example

Rss Feed Group items tagged

Nan Wang

Health Bar UI - 0 views

  • Yes, that's the way to do it. For example, this (web player). There are two textures; one for the regular graphics (using normal alpha for nice anti-aliasing) and one for the health bar (using alpha cutoff). The health bar's alpha looks like this: The non-alpha part of the texture is just a block of solid green. The code is this: Code: function Update () { renderer.material.SetFloat("_Cutoff", Mathf.InverseLerp(0, Screen.width, Input.mousePosition.x)); } This is much faster, easier, and less memory-using than having an array of circular textures.
1 - 3 of 3
Showing 20 items per page