Search Unity

SpawnWithClientAuthority does not work

Discussion in 'Multiplayer' started by marcV2g, Feb 24, 2017.

  1. marcV2g

    marcV2g

    Joined:
    Jan 11, 2016
    Posts:
    115
    This code successfully spawns a object when a new player connects but hasAuthority is false the same as if it was create using the normal network spawn.

    public override void OnServerConnect(NetworkConnection conn)
    {
    base.OnServerConnect(conn);
    //playerBehaviour
    var p = GameObject.Instantiate<PlayerBehaviour>(playerBehaviour);
    NetworkServer.SpawnWithClientAuthority(p.gameObject, conn);
    }
     
  2. marcV2g

    marcV2g

    Joined:
    Jan 11, 2016
    Posts:
    115
    So apparently SpawnWithClientAuthority only works if localPlayerAuthority is false

    Half of my confusion learning unet is with local player authority and client authority being completely separate systems with separate rules.


    EDIT:

    so having it flagged to false gives a error message but works while true gives no error message but does not work
     
    Last edited: Feb 24, 2017