Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Help Wanted [Mirror] How to check player id before adding to lobby?

Discussion in 'Multiplayer' started by starviw, Jul 8, 2021.

  1. starviw

    starviw

    Joined:
    Aug 12, 2020
    Posts:
    3
    I'm currently using the Mirror network and following the tutorial made by DapperDino and Jared Brandjes to create a lobby. However, what both of them didn't include is how can I check if the id/name entered by the player exists in the room before the player is added in.

    I know I need to create a connection first to get the info the server holds, but I do not know how I can get it after connected. I tried checking in OnClientConnect(NetworkConnection conn) but conn.identity returns null since the player hasn't been created. I considered waiting for the player to be created and start to disconnect, but it seems a little late since I could've disconnected the player before all that.

    I'm really new to networking, so any help is appreciated.

    I attached the code in text files so as not to clutter the question.
     

    Attached Files:

unityunity