Is there a way to click a button from code? ![]()
I havenāt understood ?
are you talking about GUI.Button or about keyboard keys?
OnGUI(){
if(GUI.Button(new Rect(x,y,100,100)),"button"){
someCode();
}
}
public void someCode(){
... // code 4 button click here
}
then you can use āsomeCode()ā to call the function
Sorry for the loose question. I think i figured it out. ![]()
if your code is in function āsomeCodeā, just call someCode() whenever you need it.