Quantcast
Channel: Multiplayer
Viewing all articles
Browse latest Browse all 16796

hasAuthority returns false on host after using SpawnWithClientAuthority.

$
0
0
Code (CSharp):
  1. private void OnServerAddPlayer(NetworkConnection networkConnection, short controllerId)
  2. {
  3.     var go = (GameObject)Instantiate(_vehicle, _spawnPoint.position, _spawnPoint.rotation);
  4.     NetworkServer.SpawnWithClientAuthority(go, networkConnection);
  5. }
So "hasAuthority" on that new gameobject is always false on host, but true on clients connected to the host.
I know that this is an expected behavior as stated in http://docs.unity3d.com/Manual/UNetSpawning.html...

hasAuthority returns false on host after using SpawnWithClientAuthority.

Viewing all articles
Browse latest Browse all 16796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>