Hey,
So I want to have the position of my button change once the user has clicked it. I’m not sure how to do this and haven’t found anything yet on the forums, answers, or documentation. I know I setup the GUI button with GUI.Button(Rect(ect. But How can I tell the button to change location?
Thanks!
After countless tries I figured I’d try the duh one for kicks and giggles, figuring it’d absolutely not work because it’s too simple… Yeah it worked.
ItemRect.x = #;
That’ll change the x location of your button.
You can use that for scaling the objects as well.
Edit:
More code for ya since you asked.
Rect myPosition = new Rect(0,0,1,1);
void OnGUI()
{
if(GUI.Button(myPosition), "Move me")
{
myPosition = new Rect(10,10,10,10);
}
}