How to sync non-player objects with uNet?

I have spawned in my player and I can easily sync them as I can check for “isLocalPlayer”, but each player has a gun being controlled with OVR Touch controllers and therefore need to sync’d separately.

Basically all I need to do is be able to tell if that gun belongs to a specific player so I can check that in the same way I check “isLocalPlayer” but I have become completely stuck.

Is there anyway to identify an object as being owned by a player?


Yes, you have to add a NetworkIdentity and a NetworkTransform component on your gun. With the NetworkServer.SpawnWithClientAuthority you spawn your gun on each player. The gun which belongs to the local player should have authority (hasAuthority flag) on the NetworkIdentity component.