Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by JustFamous · May 30 at 06:14 PM · multiplayerphoton

Why photon room properties not found in lobby?

The player can create a room with certain properties that once created I set them and for lobby so that I can then display them in the lobby.

Function to create room: public void OnCreateRoomButtonClicked() { RoomOptions roomOptions = new RoomOptions(); roomOptions.IsOpen = true; roomOptions.IsVisible = true; string roomName; string gameMap; if (gameMode.Equals("CarMeeting")) { gameMap = carMeetingModeMaps[mapIndex].sceneName; roomName = roomNameCarMeetingModeInputField.text; roomOptions.MaxPlayers = 4; } else { gameMap = racingModeMaps[mapIndex].sceneName; roomName = roomNameRacingModeInputField.text; roomOptions.MaxPlayers = 2; }

     if (!CheckIfRoomAlreadyExists(roomName))
     {
         StartCoroutine(EShowWarning());
     }
     else
     {
         roomOptions.CustomRoomProperties = new Hashtable();
         roomOptions.CustomRoomProperties.Add("GameMap", gameMap);
         roomOptions.CustomRoomProperties.Add("GameMode", gameMode);
         roomOptions.CustomRoomProperties.Add("RaceMode", raceMode);
         roomOptions.CustomRoomProperties.Add("InRace", false);

         string[] customLobbyProperties = new string[4];
         customLobbyProperties[0] = "GameMap";
         customLobbyProperties[1] = "GameMode";
         customLobbyProperties[2] = "RaceMode";
         customLobbyProperties[3] = "InRace";

         roomOptions.CustomRoomPropertiesForLobby = customLobbyProperties;

         PhotonNetwork.CreateRoom(roomName, roomOptions, null, null);
     }
 }

Function display rooms in lobby:

public override void OnRoomListUpdate(List roomInfo) { Debug.Log("Rooms found " + roomInfo.Count); bool roomFound = false;

     foreach (RoomInfo room in roomInfo)
     {
         if (room.RemovedFromList)
         {
             int index = roomUIs.FindIndex(x => x.roomNameString.Equals(room.Name));

             if (index != -1)
             {
                 Destroy(roomUIs[index].gameObject);
                 roomUIs.RemoveAt(index);
             }
         }
         else
         {
             CMRoomUI cacheRoomUI = roomUIs.Find(x => x.roomNameString.Equals(room.Name));
             if (cacheRoomUI != null)
             {
                 if (room.CustomProperties["GameMode"].ToString().Equals("CarMeeting"))
                     cacheRoomUI.Check(room.Name, (room.PlayerCount + "/" + room.MaxPlayers).ToString(), room.CustomProperties["GameMap"].ToString(), room.CustomProperties["GameMode"].ToString());
                 else
                     cacheRoomUI.Check(room.Name, (room.PlayerCount + "/" + room.MaxPlayers).ToString(), room.CustomProperties["GameMap"].ToString(), room.CustomProperties["GameMode"].ToString()
                         , room.CustomProperties["RacingMode"].ToString());
             }
             else
             {
                 if (room.IsOpen)
                 {
                     CMRoomUI roomUI = Instantiate(roomUIPrefab.gameObject, roomUIParent).GetComponent<CMRoomUI>();
                     roomUIs.Add(roomUI);
                     if (room.CustomProperties["GameMode"].ToString().Equals("CarMeeting"))
                         roomUI.Check(room.Name, (room.PlayerCount + "/" + room.MaxPlayers).ToString(), room.CustomProperties["GameMap"].ToString(), room.CustomProperties["GameMode"].ToString());
                     else
                         cacheRoomUI.Check(room.Name, (room.PlayerCount + "/" + room.MaxPlayers).ToString(), room.CustomProperties["GameMap"].ToString(), room.CustomProperties["GameMode"].ToString()
                           , room.CustomProperties["RaceMode"].ToString());
                 }
             }
         }
     }

     if (roomUIs.Count > 0) roomFound = true;
     noRoomTextObj.SetActive(!roomFound);
 }

After I create a room if another player connects to the looby, I display the cameras visible with those properties, but the property "RaceMode" does not exist.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

231 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to have the Scenes download upon request? 1 Answer

How to get all created rooms and join any one of them in PHOTON 2 Answers

Networking (?) 1 Answer

How can i close or make it invisible photon multiplayer room? 1 Answer

How to make a host-client server? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges