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.
Health Bar UI - 0 views
Ge.tt | Nan Wang - 0 views
1 - 7 of 7
Showing 20▼ items per page