- Home /
Network fps swap cameras
So when I run my multiplayer game, player 1 spawns and works fine. When player 2 comes, they control their own character, but see through the other persons camera. I have the same if(!networkView.isMine){ enabled = false bit on both. Some people have mentioned that the network example addresses this problem, and that it's something to the extent of get the 'others' controller scripts and disable them in each client, once they spawn. I don't know exactly what that means, and I can't seem to get the networking example working. Any help with either advice on the problem or how to get the networking example to work would be much appreciated.
Answer by suyujin · Dec 16, 2011 at 05:34 AM
Suppose I'll answer my own question again :) When I just use
`if(!networkView.isMine){
enabled = false;
}`
the cameras still screw up. I know logically it's the same, but when I switched to
function Awake() {
if(networkView.isMine){
camera.enabled = true;
}else{
camera.enabled = false;
}
}
it works. Not sure what's up with that one, but glad my camera problem is fixed. Btw, that's the only script on my camera other than mouse movement and networkView. Hope this helps the others I saw asking this question.
Well to clear up that mystery:
"enabled" inside a script ($$anonymous$$onoBehaviour class) belongs to the class and not the the camera component or any other component on this gameobject. A script is also a component which can be enabled or disabled. So your solution is the only correct one ;)
I'm just glad I fixed it. Hope others are able to find this post because I saw this problem more than any other in the networking issues ;D