Hi… I’ve created this script for show/hide an image when a button is pressed, but in play mode I don’t see the image, and I cannot set its values… Any ideas?
#pragma strict
import System.Collections.Generic;
var buttonstyle : GUISkin ;
var texture : Texture;
var mostra : boolean;
var on : boolean;
var texWidth : float; // texture width
var texHeight : float; // texture height
var texpositionx : float;
var texpositiony : float;
function OnGUI (){
GUI.skin = buttonstyle;
if(GUI.Button(new Rect(808,9,35,34),"")){
GUI.DrawTexture(new Rect(Screen.width / texWidth, Screen.height / texHeight, texpositionx, texpositiony),texture);
on = !on;
if (!on){
mostra = true;
}
if (on){
mostra = true;
}
}
}