Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 ajaybhojani · May 25, 2016 at 11:12 AM · networkingmultiplayerphotonrealtime

make disappear room which has maximum player connected

Hi,.

I am making realtime multiplayer game using photon networking.

How to make disappear room which has max player connected ?

I am using following function to make text(list) empty which room has full :

 void   OnReceivedRoomListUpdate()
 {
     roomList.text = "";
     RoomInfo[] rooms = PhotonNetwork.GetRoomList ();
     Debug.Log (rooms.Length);
     foreach(RoomInfo room in rooms)
     {
         Debug.Log(" from on received room list update");;
         roomList.text += room.name + "\n";
     }
 }

To make visible false I am doing following :

     public void OnPhotonPlayerConnected(PhotonPlayer player)
 {    
     if (PhotonNetwork.player.isMasterClient) 
     {
         RoomInfo[] rooms = PhotonNetwork.GetRoomList ();
         foreach (RoomInfo room in rooms)
         {
             if(room.playerCount == 2)
             {
                 PhotonNetwork.room.visible = false;
                 PhotonNetwork.room.open = false;
                 roomList.text = "";
             }
         }
     }
 }

But still not able to make room visible false.

Please help

Thanks in advance

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by AlucardJay · May 25, 2016 at 11:37 AM

You use PhotonNetwork.GetRoomList() from the lobby, not within the room.

The example in my original answer shows how to get this information while in the lobby. Making the room visible is still the same as in your other question.

Related Question : http://answers.unity3d.com/questions/1192093/photon-multiplayer-room-make-disappear-in-lobby-wh.html


Original Question :

get no of connected player of room in lobby in photon

Hi,.

I am making realtime multiplayer game using photon networking.

is there any method to get no of connected player list in room from lobby ?

how to check room joined players in lobby in photon network ? i.e room1 Topics: photon,networking,realtime,multiplayer

Answer :

Poll for the RoomInfo from the lobby with GetRoomList.

http://doc-api.exitgames.com/en/pun/current/class_photon_network.html#aeef2085375accb7d4bc88e60cbe15eb9

The RoomInfo contains a lot of information :

http://doc-api.exitgames.com/en/pun/current/class_room_info.html

Use this to get the name, current players in room and max player count (untested example code) :

 RoomInfo[] roomInfo = PhotonNetwork.GetRoomList();
 
 for ( int i = 0; i < roomInfo.Length; i ++ )
 {
     roomText = roomInfo[ i ].name + " (" + roomInfo[ i ].playerCount + "/" + roomInfo[ i ].maxPlayers + ")";
 }

would display AwesomeRoom (2/4)

Comment
Add comment · Show 1 · Share
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
avatar image AlucardJay · May 25, 2016 at 11:39 AM 0
Share

Did you change the question while I was typing this answer? o.O

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

81 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

Related Questions

Unity networking tutorial? 6 Answers

Photon multiplayer room make disappear in lobby when room is getting full 1 Answer

how to host unity multiplayer game in my vps? 0 Answers

Unity Multiplayer (Mirror) - Problem in syncing game object's variables across all clients. [Trying to send command for object without authority] 0 Answers

Re altimeMultiplayer Module 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