Photon Multiplayer Issue

Hello I am trying to make some sort of Multiplayer Game (just testing around) and I came through this issue. Every time someone joins the server I can control them. I have fixed the camera issue with me being able to control others but now I cannot fix the issue of me controlling other players. I am using Unity’s first person controller script which can be found through Assets > Import Package > Characters. My code for my Network Manager is:

void SpawnMyPlayer()
{
    if(spawnSpots == null)
    {
        Debug.LogError("Weird... There should be Spawn Points");
    }
    SpawnSpot mySpawnSpot = spawnSpots[Random.Range(0, spawnSpots.Length)];
    lobbyCamera.enabled = false;

    GameObject myPlayerGO =  PhotonNetwork.Instantiate("Player", mySpawnSpot.transform.position, mySpawnSpot.transform.rotation, 0);

    //So you wont control other players
    //FirstPersonController controller = myPlayerGO.GetComponent<FirstPersonController>();
    //controller.

    GameObject controller_2 = myPlayerGO.GetComponent<FirstPersonController>().gameObject;
    Debug.Log(controller_2.ToString());
    controller_2.SetActive(true);

    GameObject camera = myPlayerGO.transform.FindChild("FirstPersonCharacter").gameObject;
    camera.SetActive(true);
   
}

Which should fix the issue of me controlling other players but it’s not. Please help!

Hey,

you have to check, if the current game object is yours and you are allowed to control it. Might look like this:

public void Update()
{
    if (!photonView.isMine)
    {
        return;
    }

    // Check player input
}

This requires the game object having a PhotonView component attached to it.