- Home /
 
What am I doing wrong? (Scripting question)
Hello all, I've had this problem for about a week, and I've gone through the youtube tutorial I found multi-able times, and I can't figure out what I did wrong. Here's the three tutorials I went through just incase that helps: http://www.youtube.com/watch?v=6A9YAclRWy0 , http://www.youtube.com/watch?v=J6kMMSdeZFY and http://www.youtube.com/watch?v=BJqJo46PQck
Here's the script I have:
 #pragma strict
 
 var Connection : boolean = false;
 
 var RedPlayer : GameObject;
 var BluePlayer : GameObject;
 
 var CurTeam : String = "";
 var Dead : boolean = true;
 
 var SpawnPointRed : GameObject;
 var SpawnPointBlue : GameObject;
 
 var CenterW : float;
 var CenterH : float;
 
 function Start ()
 {
     CurTeam = "";
     CenterW = Screen.width / 2 - 150;
     CenterH = Screen.height / 2 - 80;
 }
 
 function OnGUI () 
 {
 if(Network.peerType == NetworkPeerType.Disconnected)
 {
     Connection = false;
 }
 else
 {
     Connection = true;
 }
 
 if(Connection == true)
 {
 
     if(CurTeam == "")
     {
         GUI.Box(Rect(CenterW, CenterH, 300, 160,"Select a Team"));
         if(GUI.Button(Rect(CenterW + 5, CenterH + 20, 290, 65),"Red Team"))
         {
             Network.Instantiate(RedPlayer,SpawnPointRed.transform.position, transform.rotation, 0);
             CurTeam = "Red";
             Dead = false;
         }
         if(GUI.Button(Rect(CenterW + 5, CenterH + 90, 290, 65),"Blue Team"))
         {
             Network.Instantiate(BluePlayer,SpawnPointBlue.transform.position, transform.rotation, 0);
             CurTeam = "Blue";
             Dead = false;
         }
     }
     else
     {
     if(Dead == true)
     {
          GUI.Box(Rect(CenterW, CenterH, 300, 160,"Select a Team"));
          if(GUI.Button(Rect(CenterW + 5, CenterH + 20, 290, 130),"Respawn"))
          {
               if(CurTeam == "Red")
               {
                   Network.Instantiate(RedPlayer,SpawnPointRed.transform.position, transform.rotation, 0);
                   Dead = false;
               }
               if(CurTeam == "Blue")
               {
                   Network.Instantiate(BluePlayer,SpawnPointBlue.transform.position, transform.rotation, 0);
                   Dead = false;
               }
          }
     }
     }
 }
 }
 
               Lines 40 and 58 are coming up in the Console as having errors. Included are pictures of the selected lines, and of the console.



Any and all help is appreciated :)
Answer by Chronos-L · Jun 02, 2013 at 01:00 AM
 //Mistake
 GUI.Box(Rect(CenterW, CenterH, 300, 160,"Select a Team"));
 
 //Correction
 GUI.Box(Rect(CenterW, CenterH, 300, 160),"Select a Team"));
 
              Your answer
 
             Follow this Question
Related Questions
Online Multiplayer 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Can you create a Stand alone server for your game? 0 Answers
Official Unity Space Shooter Tutorial 1 Answer
C Sharp Messenger Extended Warning 1 Answer