Hello. I am relatively new on these forums so please excuse if my question is not detailed enough. I have recently made my game multiplayer, with menus and networking all set up. At the moment you can control all the players, but I know why. My NetworkView.isMine always returns true. I will give a little code segment here:
@RPC
function InstantiateNetworkPlayer(){
var temp : GameObject = new GameObject();
temp.transform.position = new Vector3(0, 0, 0);
temp.transform.eulerAngles = new Vector3(0, 0, 0);
myPlayer = Network.Instantiate(PlayerPrefab, temp.transform.position, temp.transform.rotation, 0);
if(myPlayer.networkView.isMine){
myPlayer.GetComponent(FPSInputController).enabled = true;
myPlayer.GetComponent(MouseLook).enabled = true;
myPlayer.transform.Find("Spine/Main Camera").GetComponent(Camera).enabled = true;
} else {
myPlayer.GetComponent(FPSInputController).enabled = false;
myPlayer.GetComponent(MouseLook).enabled = false;
myPlayer.transform.Find("Spine/Main Camera").GetComponent(Camera).enabled = false;
}
}
Now as you can see, this is my player instantiating code, and is called in a OnConnectedToServer() function. You can see that I stated that if my player is not mine, I disable the FPSInputController, MouseLook, and the Camera. When I play the game, however, I join the game with another window open, I have the ability to move both my characters. And so vice-versa as the host. Any help would be appreciated, in either Javascript or C#.
Thanks in advance,
william9518