#https docs multiplayer unity3d com
1 messages · Page 1 of 1 (latest)
i need to get the client id the second they log in
is there a way do do this with this resource?
Yes, you get the id when the client connects, the code is right there you can just copy paste it
what code
im sorry im pretty new to networking
like are these methods auto-called when a player logs?
// The client identifier to be authenticated
var clientId = request.ClientNetworkId;
This part gives the clientId
how do i know which client is giving me this id
It's the client that connects
so the last client that has connected?
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
wait
so
omg im dumb lol
is there a method that is auto-called by unity when a player joins?
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
There is an OnClientConnectCallback as well that you can subscribe to
is there docs for this anywhere?
The main component of the library
how do you call a callback?
srry im really new
NetworkManager.OnClientConnectedCallback += OnClientConnectedCallback;
https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-invaders
Learn more about game flow, modes, unconventional movement networked, and a shared timer using Netcode for GameObjects.