- Home /
Network FPS Input Controller problem
For my multiplayer game, I use a modified version of the FPS Input Controller script which adds this to the beginning of the update function:
if(networkView.isMine)
{
}
The problem is, when I run a client which joins the server, it ends up controlling the other character. How do I fix this?
Answer by Pfrimel · Jul 26, 2016 at 09:40 AM
Lost hours of trying to solve this problem myself. :-(
For now it seems I have a working solution - at least for my testproject :-)
1. Inherit class FirstPersonController from NetworkBehaviour (needs using UnityEngine.Networking;)
2. In Start() only do all initialization "if (isLocalPlayer)"
In the else-Branch put:
GetComponentInChildren().enabled = false;
GetComponent().enabled = false;
This line can also help:
Debug.Log("Start():" + this.GetComponent().netId + ", " + his.GetComponent().name + ", " + isLocalPlayer);
3. In Update() and FixedUpdate() also everything into a "if (isLocalPlayer)"
4. Add Network Identity to your FPSController, and check Local Player Authority
5. Add Network Transform to your FPSController. I think SyncMode Sync Transform is the correct one
But I'm still a newbie on unity, so use with caution. :-)
Your answer
![](https://koobas.hobune.stream/wayback/20220613191947im_/https://answers.unity.com/themes/thub/images/avi.jpg)