How to go to next level ?

Hi, i want to make a game. If you move to a box a messagebox/ Gui will come up that says “Do you want to go to the next level?” and if you press the button yes then you will go to the next level. if you move away from that box the GUI will disiper. Some good advice or code ? :shock:

You need to use a GUIText (maybe with a GUITexture background box) for the GUI. Put them in your scene hierarchy but have them disabled. You’ll need to write a script to say when your character moves to that box, enable the GUITexture and GUIText.

For the button, you can use Unity’s OnGUI() function (look it up) or you can instantiate another GUITexture and define a bounding rect (this method is a little more fiddly) and write code that says when you click on the bounding rect, load the next level.

To load the next level use Application.LoadLevel() (Unity - Scripting API: Application.LoadLevel)

Take a look at the Simple Game Tutorial on 3DBuzz.

He does a few GUI buttons that start the game, and restart when it’s Game Over.

Very easy to follow.

I’d link it, but it’s got a really funky, long link. Just go to 3DBuzz.com, select Unity, and you’re looking for the ‘Simple 2D Shooter’
I think video #21 is the one that is most applicable.