Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947

Problem with Player Controller management.

$
0
0

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)

        {

            Camera.SetActive(false);

            scriptPlayerController.enabled = false;

        }

    }

}


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


Viewing all articles
Browse latest Browse all 8947

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>