How to give a client authority over an object in UNET?

How would i go about doing this?
NetworkIdentity.hasAuthority and
NetworkIdentity.playerControllerId
are both read only and NetworkIdentity.localPlayerAuthority’s doc says that “LocalPlayerAuthority means that the client of the “owning” player has authority over their own player object.” but i don’t know how to have a player own an object

These pages of the documentation talks extensively about player objects in UNet, including how to spawn them:

http://docs.unity3d.com/Manual/UNetPlayers.html

Keep in mind in the current version of Unity you can only have one object with authority per player in the game, and that’s the player object.

As of Unity 5.2 we are able to give clients authority over non-player objects.

See the section titled “Client Authority for Non-Player Objects” here: http://docs.unity3d.com/Manual/UNetConcepts.html

Are you making a game that involves the concept of controlling game pieces? Like units in an RTS, or players in a party on a RPG, or what have you?

If so, i had the same problem, and not knowing any better, i made my own simple system: in the game, every object that can be controlled by a player has a string variable “Owner” that gets filled when that object is created with the name (or identifier, or what have you) of whatever player or game entity is requesting its creation.

You can make that string a Syncvar, so that the owner string of that piece is the same on all clients,and then you can play around with it, so for example, on each client you could check who is your local player, then check a game piece’s owner: if the owner string matches the local player, that game piece is a friend on that client, otherwise it’s an enemy. You could use the same check to allow that piece’s function to be called (or not) by a given player.

It’s crude, and I bet there are more elegant solutions around, but this works for me. Hope that helps or at least gives you some ideas.