I am making a NetworkBehaviour script to display player usernames in a gameplay scene, and the code for displaying the usernames is run in OnNetworkSpawn().
I want to display the current player’s username differently, so I would need to be able to access the client id of the current player.
Hi,
I’d recommend using OwnerClientd, which is the ID set by the server for each PlayerPrefab created per unique connection. Have a look at an example here:
Here is also the official documentation page for Netcode for GameObjects: