- Home /
Networking Basics Big Problem
Hey guys, When I start server I create new player but when someone join as a client everyone can control everyone. Players aren't independent, they're doing exactly the same moves.
I've been using standard first person controler as player. The script which create server is the same as one in unity multiplayer tutorial (direct connection).
Here is my script for spawn:
#pragma strict
#pragma implicit
#pragma downcast
public var playerPrefab : Transform;
function OnServerInitialized(){
Spawnplayer();
}
function OnConnectedToServer(){
Spawnplayer();
}
function Spawnplayer(){
var myNewTrans : Transform = Network.Instantiate(playerPrefab, transform.position, transform.rotation, 0);
}
function OnPlayerDisconnected(player: NetworkPlayer) {
Network.DestroyPlayerObjects(player);
}
function OnDisconnectedFromServer(info : NetworkDisconnection) {
Network.DestroyPlayerObjects(Network.player);
Application.LoadLevel(Application.loadedLevel);
}
Comment
I find out what should I do. There is no networkView.is$$anonymous$$ine checking.
Answer by Anxo · Nov 22, 2011 at 08:19 PM
in the docs, look up "isMine" you can use that as a condition in the controls.
Your answer
![](https://koobas.hobune.stream/wayback/20220613052209im_/https://answers.unity.com/themes/thub/images/avi.jpg)