#https docs multiplayer unity3d com

1 messages · Page 1 of 1 (latest)

nocturne hare
#

i need to get the client id the second they log in

#

is there a way do do this with this resource?

dry granite
#

Yes, you get the id when the client connects, the code is right there you can just copy paste it

nocturne hare
#

what code

#

im sorry im pretty new to networking

#

like are these methods auto-called when a player logs?

dry granite
#
    // The client identifier to be    authenticated
    var clientId = request.ClientNetworkId;

This part gives the clientId

nocturne hare
#

how do i know which client is giving me this id

dry granite
#

It's the client that connects

nocturne hare
#

so the last client that has connected?

dry granite
#

It's executed each time a client connects, so you get the id for all of them in the order they connect

#

But yes that would store the id of the last client that has connected

nocturne hare
#

wait

#

so

#

omg im dumb lol

#

is there a method that is auto-called by unity when a player joins?

dry granite
#

Yes, the ConnectionApprovalCallback is called when a client connects to the server

#

Or to be more precise it is called when a client attempts to connect

sinful glade
#

There is an OnClientConnectCallback as well that you can subscribe to

nocturne hare
nocturne hare
sinful glade