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: 5. Unity3D How to make a game like Call of Duty - Multiplayer Spawn - YouTube , 6. Unity 3D how to make a game like Call of Duty - Teams - YouTube and 7. unity 3d how to make a game like Call of Duty - Setting up the scripts - YouTube
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