here is the test class i made:
class Button extends Object{
//VARIABLES
var x:int;
var y:int;
var w:int;
var h:int;
var texture:Texture2D;
//CONSTRUCTOR
function Button(){
x=10;
y=10;
w=30;
h=30;
}
function Show(){
if(GUI.Button(Rect(x,y,w,h),texture)){
Debug.Log("Button Pressed!");
}
}
}
slot for texture appears when i create the object in other script. here is how i did it:
var TestButton : Button;
then in the OnGUI function i just type this:
TestButton.Show();
the button shows and it works but texture is not there but i put it in the slot from the inspector, what i am doing wrong?
here is the screenshot: