GUI Button in texture image mapping,
on button clicked, want texture image change…
how to GUi texture image change?
GUI Button in texture image mapping,
on button clicked, want texture image change…
how to GUi texture image change?
Dude, changing the texture of a guitexture is a simple process, you can do it either with a GUI Skin as suggested by PushpaK , or check this example… it might help you…
just comment if anything is not clear about the code
public var yourGUITexture:GUITexture;
public var texture1:Texture2D;
public var texture2:Texture2D;
private var yourCurrentTexture:Texture2D;
private var showAlert = false;
// whenever you will show the window just set showAlert = true;
function OnGUI()
{
if(showAlert)
var window = GUI.Window(0 , Rect(posX,posY,someWidth,someHeight), ShowAlert ,"");
yourGUITexture.texture = yourCurrentTexture;
}
function ShowAlert(windowID : int)
{
if (GUI.Button (Rect(posX,posY,someWidth,someHeight), "LeftButton"))
{
showAlert= false;
yourCurrentTexture = texture1;
}
if (GUI.Button (Rect(posX*2,posY,someWidth,someHeight), "RightButton"))
{
showAlert= false;
yourCurrentTexture = texture2;
}
}