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:



The problem is, when I run a client which joins the server, it ends up controlling the other character. How do I fix this?

Lost hours of trying to solve this problem myself. :frowning:

For now it seems I have a working solution - at least for my testproject :slight_smile:

  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<AudioListener>().enabled = false;
            GetComponent<CharacterController>().enabled = false;

This line can also help:

Debug.Log(“Start():” + this.GetComponent().netId + ", " + his.GetComponent().name + ", " + isLocalPlayer);

  1. In Update() and FixedUpdate() also everything into a “if (isLocalPlayer)”

  2. Add Network Identity to your FPSController, and check Local Player Authority

  3. 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. :slight_smile: