NetworkBehaviour Get Id of Current Client on Network Spawn

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.

How exactly could I do that?

I think with this:
NetworkManager.Singleton.LocalClientId

I would link the scripting API but unfortunately it seems currently unreachable.

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:

Hope that helps!