so far i was using components, i want to try with classes now. i made a simple class, but it seems that i do not know how to use it. here is the example:
class test extends MonoBehaviour{
var show : boolean=false;
function OnGUI(){
if(show){
GUI.Label(Rect(200,200,200,200),"Label");
}
if(Input.GetMouseButtonDown(0)){
show=!show;
}
}
}
so pressing the button, label should show, but when i try to instantiate the object of this class in other script i do not get the desirable result. i tried to do something like this: `var test : test=new test();` //this does not work on monobehaviours then i tried this: `var test : test;`// this does not automatically start the OnGUI function in the class i even tried this `test.OnGUI` in other scripts OnGUI, that clearluy did not work.
so can somebody explain how to use the monobehaviour class and all basic things related to it. thanks!!