Hi all,
Is there a way to draw only part of a texture? For example, can I only draw half of a GUI health-bar? If not, is there a way I can move alpha of a texture? Just looking for the names of the functions.
Thanks,
- Alex
Hi all,
Is there a way to draw only part of a texture? For example, can I only draw half of a GUI health-bar? If not, is there a way I can move alpha of a texture? Just looking for the names of the functions.
Thanks,
You can do this by drawing the texture inside a group. You can use negative coordinates within the group to start drawing the picture outside and thereby show any part of it you like:-
var groupRect: Rect; // Make this smaller than the texture rectangle.
var texRect: Rect;
var tex: Texture2D;
function OnGUI() {
GUI.BeginGroup(groupRect);
GUI.Label(texRect, tex);
GUI.EndGroup();
}