How to get player object that owns spawned object

I have an object that I spawned with NetworkServer.SpawnWithClientAuthority. From that spawned object on the client how can I get the player object that owns it? Preferably from inside OnStartClient().

As far as I can tell from reading the code here when you SpawnWithClientAuthority the player you pass in is only used to get the client connection that is going to be given authority. I don’t think any player actually owns the object. After all it is “SpawnWithClientAuthority” not “SpawnWithPlayerAuthority.”

I was curious how I deal with this in my own game it seems like I worked around the issue by calling a [ClientRpc] on the owner player and passing in each of the objects that I just spawned for them. Each player can then keep track of which non-player objects they have control of.

Clients have NetworkConnection which keeps track of some of that, accessed from NetworkManager.client.connection which has a list of player controllers (controllers have a reference to the player object) on the local connection.

There is a list of client Authority objects in NetworkConnection.clientOwnedObjects, but this list is only tracked on the server.

Local Authority isn’t set until OnStartAuthority() gets called on the client NetworkBehaviour. If NetworkBehaviour/NetworkIdentity.hasAuthority is set, then the local client owns it.