C#, GUI.Button variable assigning

Is there anyway that I could assign a variable to a gui.button and check for clicking?

like…

Would that work?

GUI.Button returns a boolean, so if(GUI.Button(…)) { } should work.

But I want to assign a variable, then check.
how is this done?

It would work if you change the type of My_Button. Look at the return type of the Button function. It returns a bool, not a GUI.

1 Like