2
\$\begingroup\$

I want to transform my GUIWindow from the bottom of the screen to the middle whenever the user presses a button. How can I do this?

\$\endgroup\$
1
\$\begingroup\$

Using isGuiUp to store a state (location of GUI), then an if statement to determine the proper location of the GUI.

Add the following to the Update() funciton of your gui controller script.

bool isGuiUp = false;

if (Input.GetKeyUp(KeyCode.Escape))
{ 
    isGuiUp = !isGuiUp; //toggle the state
}

if (isGuiUp == true)
{
    //code to move the gui to the middle of the screen
}
else
}
    //code to move the gui to the bottom of the screen
}
\$\endgroup\$
  • \$\begingroup\$ Well Thanks But I found the answer. In fact, I was not asking about logic as It is straighforward. I was asking for some Inbuit feature. I used LeanTween to achieve this. Thanks :) \$\endgroup\$ – Adnan Nazir May 1 '14 at 6:13
  • 3
    \$\begingroup\$ Then please answer your own question with what you learned and help the community. Please don't take the time to ask questions if you aren't also willing to take the time to answer your own questions when you solve it yourself. \$\endgroup\$ – badweasel Feb 26 '15 at 5:13
  • \$\begingroup\$ ok sure badweasel ! I'll for sure, take super care from now on. \$\endgroup\$ – Adnan Nazir Feb 2 '16 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.