Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

Scenes automatically skip without initialisation.

$
0
0
Hi there. I've been following the space shooter tutorials in C#. I've already added my scenes, and my "Start" button. For some reason when I run the scene, it automatically skips over to the next scene without the button being pressed. My coding seems right. Are there perhaps settings in Unity itself which would cause this? using UnityEngine; using System.Collections; public class MainMenu : MonoBehaviour { #region Fields private string instructionText = "Instructions:\nPress Left and Right Arrows to move.\nPress Spacebar to fire."; private int buttonWidth = 200; private int buttonHeight = 50; #endregion #region Properties #endregion #region Functions void OnGUI() { GUI.Label(new Rect(10, 10, 250, 200), instructionText); if (GUI.Button(new Rect(Screen.width / 2 - buttonWidth / 2, Screen.height / 2 - buttonHeight / 2, buttonWidth, buttonHeight), "Start Game")) ; { Application.LoadLevel(1); } } #endregion }

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>