Search Unity

Max player count ? how ? thank you.

Discussion in 'Netcode for GameObjects' started by MomoThePopo, Jul 4, 2021.

  1. MomoThePopo

    MomoThePopo

    Joined:
    Jun 3, 2017
    Posts:
    2
    In my game I want to have 4 players max. I have a lobby screen where you can host/ connect as client and i need some way to check if the server we are trying to connect to is full. Every kind of help will be appreciated!
     
  2. luke-unity

    luke-unity

    Joined:
    Sep 30, 2020
    Posts:
    306
    You can use connection approval and check for the amount of connected clients by checking the ConnectedClients list of the NetworkManager and deny the connection if there are 4 players already.