Search Unity

On Client - How to know how many other players there is?

Discussion in 'Multiplayer' started by Deleted User, Mar 7, 2017.

  1. Deleted User

    Deleted User

    Guest

    Hello folks!

    I have been reading UNet doc in trying to find a way on a client to find whose the other "connections", but without avail...

    OnServerConnect and OnClientConnect won't work. (OnClientConnect is only called for the connecting client).

    Why do I need this? I am showing a text when a new player joined (and basically want to keep a list on clients of other player gameobject in a neat network way).

    Any help would be welcome!
     
  2. angusmf

    angusmf

    Joined:
    Jan 19, 2015
    Posts:
    261
    Keep track of it on the server and notify the clients when there is a change?
     
  3. Deleted User

    Deleted User

    Guest

    Yeah that was the solution I had in mind. Not ideal. But wtv, if thats the way to do it. So be it.
     
  4. srylain

    srylain

    Joined:
    Sep 5, 2013
    Posts:
    159
    Typically nowadays you don't want one client to be able to access details about another client, because that can lead to some pretty nasty stuff (like DDOS's and the like) since you're basically giving client IP's to everyone. If you are only ever connected to the server, you only have access to one IP that isn't yours and no one else's.

    So if one client needs to know about another, you let the server do the talking.