Does PhotonNetwork.LocalPlayer.NickName carry over scenes?

Hey, I'm gonna keep this short. Currently I'm using this to display players nickname in the lobby

            PhotonNetwork.LocalPlayer.NickName = loginEmail.text;
            playerNickName.text = PhotonNetwork.LocalPlayer.NickName;

The above code works, but I'm trying to display the players name above the player in the game scene, and I simply call

_playerNhame.text = PhotonNetwork.LocalPlayer.NickName;

Returns null though? Can I not set the localPlayers nickname?

Answers

  • Tobias
    Tobias admin
    edited October 2022

    You can set it and use it and in PUN it's independent from the scene and room.

    Make sure it's being set. If it is, you can attach a debugger and check when it's being set to Null again. I am not aware of code in PUN that sets it to Null.