- Home /
Moving buttons
Hi there,
This may be a noob question but I can't seem to find anything on it
I want to make my buttons to essentially "move into position," for example when you press escape, they might be in position x to start, but then over a second it moves into position x +10.
I have no idea how to do it as all my buttons are if statements and don't even know where I'd put any code, let alone what code exactly
Any help would be greatly appreciated :)
Comment
Answer by DaveA · Nov 01, 2011 at 12:59 AM
You'd put it in an Update function. Something like (untested)
Rect myButtonRect;
function Update()
{
if (myButtonRect.x < 10)
myButtonRect.x += .1;
}
function OnGUI()
{
if (GUI.Button (myButtonRect, .......
}