Problem with Player Controller management.


Hello! I have a problem with the PlayerController.cs script - for example, when I create a room and a second player connects to me, it turns out that I control them, and he controls me. How to fix such a problem? I searched the whole Internet, but I couldn't find anything.

Here is the code of the PlayerController script itself:

using UnityEngine;

using Photon.Pun;

public class PlayerSetup : MonoBehaviour


    public PhotonView view;

    public GameObject Camera;

    public PlayerSetup scriptPlayerController;

    private void Awake()


        view = GetComponent<PhotonView>();

        if (!view.IsMine)



            scriptPlayerController.enabled = false;




I would be very grateful if you would help me. Sincerely, Dmitry.