image next

hello, who knows how to make a style menu prev next gui button, I have a few pictures and as I press next it is to load a new image

thx all

my script

var cashgui : GUIText; 
var cash = 4000; 
var textureToDisplay : Texture2D[]; 
var TextureInt = 1; 
var button1 = false; 
var button2 = false; 
var menu = false; 
var buttonSklepOn = false; 
var buttonSklepOff = false; 

function OnGUI () { 
    if (buttonSklepOn){ 
        if (GUI.Button(Rect(20,20,100,25),"sklep on")){ 
            menu = true; 
            buttonSklepOff = true; 
            buttonSklepOn = false; 
        } 
    } 
    if (buttonSklepOff){ 
        if (GUI.Button(Rect(20,20,100,25),"sklep off")){ 
            menu = false; 
            buttonSklepOn = true; 
            buttonSklepOff = false; 
        } 
    } 
    if (menu){ 
        GUI.Box(Rect(120,120,300,325), ""); 
        GUILayout.BeginArea(Rect(120,120 ,300,325),""); 
        GUILayout.BeginVertical(); 
        if (button1){ 
            if (GUI.Button(Rect(20,20,50,25),"<")){
                
            }
        } 
        if(button2){
            if(GUI.Button(Rect(225,20,50,25),">")){ 
                button1 = true; 
                button2 = true; 
            } 
        } 
        GUI.Box(Rect(200,200,200,200),""); 
        GUILayout.EndVertical(); 
        GUILayout.EndArea(); 
    } 
} 

function Start (){ 
    menu = false; 
    button1 = true; 
    button2 = true; 
    buttonSklepOn = true; 
    textura1 = true; 
} 

I’ll assume that TextureInt should be the current displayed texture index. Just use GUI.DrawTexture to display the surrent texture.

Instead of you GUI.Box do this:

    if (TextureInt > 0){
        if (GUI.Button(Rect(20,20,50,25),"<")){
            TextureInt--;
        }
    }
    if(TextureInt < textureToDisplay.Length-1){
        if(GUI.Button(Rect(225,20,50,25),">")){ 
            TextureInt++;
        }
    }

    if (TextureInt >= 0 && TextureInt < textureToDisplay.Length)
        GUI.DrawTexture(Rect(200,200,200,200),textureToDisplay[TextureInt]);