how can i create a 2D pop up box like Angry Bird games, when we want to quit the game. it will pop a image either you click right and x button… sorry im a newbie with unity…thanks
The GUI interface in Unity makes that really easy.
Create an empty GameObject and add a script with something like the following:
Rect _quitWindowRect = new Rect ( Screen.width/2-125, Screen.height/2-25, 250, 50 );
void OnGUI()
{
if ( quitRequested )
{
GUI.Window ( QUIT_WINDOW_ID, _quitWindowRect, QuitWindowFunction, "Quit?" );
}
}
void QuitWindowFunction ( int id )
{
if ( GUI.Button ( new Rect ( 10, 10, 100, 30 ), "yes" )
{
// TODO: shut down the game...
}
if ( GUI.Button ( new Rect ( 120, 10, 100, 30 ), "NO!!" )
{
// TODO: return to game
}
}
thanks for your answer royce3…
that coding got error… it say (UCE0001: ‘;’ expected. Insert a semicolon at the end.)