GUI Texture Touch Android

Hi guys,

I got a couple of GUI textures in 1 script and I want that each texture has his own function.
By example. If you touch GUITexture_01, you go to Scene_01 and if you touch GUITexture_02, you go to Scene_02.

This is the script I use, but I couldn’t find a solution.

    var Season_01:Texture2D : Touch = Input.touches[0];
    var Season_01Width:float = 100;
    var Season_01Height:float = 100;
    
    var Season_02:Texture2D : Touch = Input.touches[0];
    var Season_02Width:float = 100;
    var Season_02Height:float = 100;
    
    function OnGUI(){
     
           GUI.DrawTexture(Rect( (Screen.width - Season_01Width)*0.05,(Screen.height - Season_01Height)*0.3, Season_01Width, Season_01Height), Season_01);
           GUI.DrawTexture(Rect( (Screen.width - Season_02Width)*0.15,(Screen.height - Season_02Height)*0.3, Season_02Width, Season_02Height), Season_02);
    }

function Update () {
    if(Input.touchCount >= 0) {
        if(Season_01.phase == TouchPhase.Began)
        {
			Application.LoadLevel("Scene_01");
        }
        if(Season_02.phase == TouchPhase.Began)
        {
			Application.LoadLevel("Scene_02");
        }
    }
}

Someone who can tell me what I did wrong and can help me figure this out?
Please HELP!.

Thanks in advance

I’m not sure how to do that with a drawTexture but you can use a Button with a custom skin. Inside that custom skin just make all the button styles a transparent image, doesn’t have to be big can even be a few pixels; just 100% transparent.

Then just instead of GUI.DrawTexture use

if(GUI.Button(Rect( (Screen.width - Season_01Width)*0.05,(Screen.height - Season_01Height)*0.3, Season_01Width, Season_01Height), Season_01, theTransparentGUIStyle)){
    Application.LoadLevel("Scene_01");
}
if(GUI.Button(Rect( (Screen.width - Season_02Width)*0.15,(Screen.height - Season_02Height)*0.3, Season_02Width, Season_02Height), Season_02, theTransparentGUIStyle)){
    Application.LoadLevel("Scene_02");
}

Please excuse any errors, I code in C# not in JS, so I can’t garentee that is copy and paste-able

I figured it out, but thanks for help. This is what it should be.

    var MenuSkin:GUISkin;
    var Season_01:Texture2D;
    var Season_01Width:float = 100;
    var Season_01Height:float = 100;
 
    var Season_02:Texture2D;
    var Season_02Width:float = 100;
    var Season_02Height:float = 100;
 
function OnGUI () {
		GUI.skin = MenuSkin;
		
		if(GUI.Button(Rect( (Screen.width - Season_01Width)*0.05,(Screen.height - Season_01Height)*0.3, Season_01Width, Season_01Height), Season_01)){
		    Application.LoadLevel("Scene_01");
		}
		if(GUI.Button(Rect( (Screen.width - Season_02Width)*0.15,(Screen.height - Season_02Height)*0.3, Season_02Width, Season_02Height), Season_02)){
		    Application.LoadLevel("Scene_02");
		}
}