Local network can conect, but not correctly.

#pragma strict
var player : GameObject;
var ar : Transform;
function Update(){
Debug.Log(MasterServer.PollHostList().Length);

}
function OnGUI(){

GUILayout.BeginVertical();
if(Network.peerType == NetworkPeerType.Client && Network.peerType != NetworkPeerType.Server && GUILayout.Button("Disconnect")){
Network.Disconnect();
}
if(Network.peerType != NetworkPeerType.Client && Network.peerType != NetworkPeerType.Server && GUILayout.Button("Connect")){
Network.Connect("127.0.0.1",25001);
}
if(Network.peerType != NetworkPeerType.Server && GUILayout.Button("StartServer")){

Network.InitializeServer(32, 25001, false);
//
SPawn();
MasterServer.RegisterHost("YUSBABY", "jellah", "flubba");
if(MasterServerEvent.RegistrationSucceeded){
Debug.Log("YAY!!!!");
}

}

if(Network.peerType == NetworkPeerType.Server && GUILayout.Button("Shut Down Server")){
Network.Disconnect();
}
}
function OnServerInitialized(){
Debug.Log("Yay");
}
function SPawn (){ 
Network.Instantiate(player, ar.position,Quaternion.identity,0);
}
function OnConnectedToServer(){
SPawn();

}

This works, but not correctly. what I mean is, is it recognized there is a server, but no players, but it instantiates all the players on connect, or shows them, but in one place. it just doesn’t connect correctly :confused:

and it doesn’t even count player or server count either.

but if I had 2 people on. I connect, and 2 people are instantiated, and if theres 4 and I join, 4 people are instantiated, but in same place.

what do you mean doesnt connect correctly? it instantiates 4 objects for four player? and you are able to see it in all four instances?? then it works fine!

My guess is ar.position is a fixed value(!) then obviously everything will spawn in same place.

Additionally check if Run in back ground enabled.

Follow M2H tutorials, pretty good place to start networking at!