Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


RyanSchurton

Member Since 02 Mar 2012
Offline Last Active Mar 02 2012 12:16 AM

Topics I've Started

2d Space shooter Main Menu Problem

02 March 2012 - 12:15 AM

so I've been doing this little project and following a tutorial on 3d buzz to make a top down shooter. Well all was going smooth I have finished most of the game until I had to make a main menu I have came across a problem with my code.








using UnityEngine;[/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]using System.Collections;[/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]public class MainMenu : MonoBehaviour[/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]{ [/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]#region Fields[/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]private string instructionText = "Instruction:\nPress Left and Right Awrrows to move.\nPress Spacebar to fire." [/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]private int buttonWidth = 200;[/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]private int buttonHeight = 50;[/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]#endregion[/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]#region Properties[/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]#endregion[/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]#region Functions[/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]void OnGui()[/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]{[/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]  GUI.Label(new Rect(10, 10, 250, 200), instructionText);[/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]  if (GUI.Button(new Rect((Screen.width / 2) - (buttonWidth / 2),  [/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]					   Screen.height / 2 - buttonHeight / 2, buttonWidth, buttonHeight), "Start Game")); [/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]  {[/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]    Application.LoadLevel(1);				  [/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]  }[/size][/font][/color]

[color=#111111][font=Helvetica, Arial, sans-serif][size=3]} [/size][/font][/color]

[color=#111111][font=Helvetica, Arial, sans-serif][size=3]#endregion[/size][/font][/color]
[color=#111111][font=Helvetica, Arial, sans-serif][size=3]}[/size][/font][/color]

[color=#111111][font=Helvetica, Arial, sans-serif][size=3]


I am getting an error in unity that says Assets/Scripts/MainMenu.cs(9,15): error CS1519: Unexpected symbol `private' in class, struct, or interface member declaration.
private int buttonWidth = 200;

there is a red line under it but I cant seem to find out what is wrong. Hopefully someone who is awesome can. If you have any question or if I am leaving something out please let me know. Posted Image

PARTNERS