PUN 2 how to reference yourself?

Options
I am trying to set up a system in my game where the LocalPlayer has the ability to start the game once all players have joined.

Basically, is there some way for the game to check if a player is the LocalPlayer/host?

The equivalent of this psuedocode:
if(PhotonNetwork.LocalPlayer.IsMe)
{
ShowMenu();
ShowStartGameButton();
}
else if(!PhotonNetwork.LocalPlayer.IsMe)
{
ShowMenu();
}

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @BlitzBurn,

    Thank you for choosing Photon!

    PhotonNetwork.LocalPlayer is always referring to the local client.

    Otherwise you could use the helper properties:

    Player.IsLocal
    PhotonView.IsMine
  • BlitzBurn
    Options
    @JohnTube
    Thanks for the tips!