- Home /
Question by
Developer1212 · Oct 04, 2015 at 05:50 PM ·
gui.buttonstrange
Problem with the "Play again" button.
Ok so here's something that I really don't get. Here's the code:
#pragma strict
function OnGUI () {
GUILayout.Button("Play again!"); // It should make a button in the corner saying "play again" :(
}
Yet when I run the game the button doesn't appear. Mods if you reject this question please answer the other sub-questions I have to do with this topic. Thanks!
Comment
Answer by engieelec · Oct 04, 2015 at 07:16 PM
This is using the old GUI style:
if (GUI.Button (Rect (20,40,80,20), "Level 1")) {
Application.LoadLevel (1);
}
You can use the new UI system to create a canvas and add a button. Then write a script to determine what happens when you press the button.