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! Your search result can be found below. Plus, we offer support via 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.

Pls Show example code how to add custom properties listed in lobby and how to get them from lobby

Hmmm
2021-10-16 08:08:56

pls answer i try to make password room with custom properties with photonnetwork.custompropertieslistedinlobby and room options custom properties for lobby and when i try to get it it say hasnt be assigned the code i use to get it is

roominfo.customproperties[0] == passwordinput.text

and this is the code i try to make custom properties listed in lobby

if (PhotonNetwork.LocalPlayer.IsMasterClient)

{

PhotonNetwork.CurrentRoom.SetPropertiesListedInLobby(new string[1] { CreatePasswordInput.text });

}

pls help.

pun2 btw

Comments

[Deleted User]
2021-10-17 20:41:06

Hi, please make sure that the properties are in the lobby during creation of the room. PropertesListedInLobby refers to which keys of your room properties are exposed for everyone currently in the Lobby. You don't set values in the string array, you set the keys of the Hashtable which you want to expose the value of.

An example can be found below:

The "Password" property inside of the CustomRoomProperties will now be dispatched along with the actual room. If you want to update the password while you're inside of the game, you can modify the properties like so:

Please make sure to avoid filling the lobby properties with large amounts of data. All of this data will get dispatched to everyone currently connected to the lobby (providing they're not using SQL lobbies). If you have large amounts of data in the lobby properties then it will clog up the MasterServer and make automatic room updates slower.

Lastly, please be aware that you are sending the password inside of the room properties. This works for now, but if your game gets popular then cheaters will be able to enter rooms since they can find it locally. Please consider making your rooms hidden by default using the IsVisible property if you want to have properly hidden rooms. The only downside to this of course, is that you can't see those rooms in the Lobby anymore.

Hmmm
2021-10-17 23:29:07

thanks, i know the password is not secure but i already create lock room feature and about the password i already figured so what iam doing when click on room button i join and get the password lastestRoomPassword = PhotonNetwork.CurrentRoom.PropertiesListedInLobby[0]; and leave.

Back to top