Does PhotonNetwork.LocalPlayer.NickName carry over scenes?

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Does PhotonNetwork.LocalPlayer.NickName carry over scenes?

Johan_Liebert96
2022-10-10 01:59:28

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?

Comments

Tobias
2022-10-10 15:05:40

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.

Back to top