- Home /
mouse over and change texture
i want to mouse over "GUI.Button(Rect(25,Screen.height-256,256,256),box1)"than change my backgroundTextureA To B.
And mouse over "GUI.Button(Rect(25,Screen.height-256,256,256),box2)"than change my backgroundTextureA To C.
I tried to use OnMouseEnter to clear my question but I failed!!
var mygui:GUIStyle;
var backgroundTexture:Texture;
var backgroundTexture2:Texture;
var backgroundTexture3:Texture;
var backgroundTexture4:Texture;
var backgroundTexture5:Texture;
var mobe:Texture;
var back : Texture;
var store : Texture;
var box1 : Texture;
var box2 : Texture;
var box3 : Texture;
var box4 : Texture;
function OnGUI () {
GUI.DrawTexture(new Rect(0,0,Screen.width,Screen.height),backgroundTexture);
GUI.DrawTexture(Rect(0,Screen.height-256,1280,256),mobe);
GUI.skin.button = mygui;
if (GUI.Button(Rect(25,Screen.height-256,256,256),back))
Application.LoadLevel(0);
if (GUI.Button(Rect(Screen.width-280,Screen.height-256,256,256),store))
Debug.Log("Clicked the button with an image");
if (GUI.Button(Rect(Screen.width/2-420,Screen.height-256,256,256),box1))
Application.LoadLevel(2);
if (GUI.Button(Rect(Screen.width/2-235,Screen.height-256,256,256),box2))
Debug.Log("Clicked the button with an image");
if (GUI.Button(Rect(Screen.width/2-20,Screen.height-256,256,256),box3))
Debug.Log("Clicked the button with an image");
if (GUI.Button(Rect(Screen.width/2+165,Screen.height-256,256,256),box4))
Debug.Log("Clicked the button with an image");
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613081752im_/https://answers.unity.com/themes/thub/images/avi.jpg)