Check if Client

Options
So in my game, when I finished putting photon views on everything, and when I tested out the game, I could control the two players with the same controls!
In uNET, all I had to do was check "localPlayer" and that would fix everything.

Is there anyway to do this with PUN?

Comments

  • SullyBully
    Options
    Edit: I got it to work by using "if (!PhotonNetwork.LocalPlayer.IsLocal)
    return;"
  • develax
    develax ✭✭
    edited July 2019
    Options
    Hi @SullyBully,
    if your class inherits from `MonoBehaviourPun` you can use

    bool isLocal = photonView.IsMine || !PhotonNetwork.IsConnected;

    `!PhotonNetwork.IsConnected` is there for the case when you want to run your map without connecting to the server.