How to slide UVs of a GUI Texture

I have a GUI Texture of a boost gauge, the texture contains all 5 states of the boost gauge. Instead of having to cut them up into 5 different textures and swapping them between them when my condition becomes true, I would rather use only 1 texture and "slide" the UVs down to the new boost gauge state.

I tried GUI.DrawTexture but it doesn't work for sliding UVs. I was thinking about using iTween to slide the UVs, but I don't even know how to specify the UV coordinates between which to slide. Does anyone have a good method for sliding UVs on a GUI Texture ?

The public beta (Unity 3.5 version) now contains

GUI.DrawTextureWithTexCoords(PositionRect, Texture, UVRect);

This works fine with GUI with GUILayout!

Thanks!

Roger

GUITextures have no access to UVs. You can use a custom plane with an unlit shader, and change renderer.material.mainTextureOffset.

Hi, you can make that using this:

Function OnGUI() {
    GUI.BeginGroup(the position and size of the button);
    GUI.Label(the main texture);
    GUI.EndGroup();
}

then use a functiont to make the image moves an "x" value in the position.x example: the image have a 60 width and have 5 images on it, the width of every image will be 12, so add 12 at every x-time in the position.x in the GUI.Label position so the image looks like a gif animation.

Graphics.DrawTexture(PositionRect, Texture, UVRect, 0, 0, 0, 0);

solves the problem with one line of code.
This does not include GUILayout, here it will work only with some limitations.

Regards,
Roger