Unet assigning local player Authority to a gameObject.

Updated on November 3, 2018 in [A] Multiplayer
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
3 on July 8, 2017

Hello everyone, i have been working on this issue for a couple days now and i can’t seem to find an answer. So i was hoping one of you inelegant beings could help me out 😉


What i want to do is when the player connects to the server i want them to spawn the chosen character they picked in the lobby screen. I have that part done, but the issue is that when i try and spawn the player using NetworkServer.SpawnWithLocalPlayerAuthorty, it seems it does not want to give local auth to me.


Here is some of my code. This code is placed on an empty game object that is spawned when a player connects. And yes it has local Player Auth checked using


public class SpawnPlayer : NetworkBehaviour {

public GameObject[] playerPrefabs;
public int playerIndex = 0;
float timer = 3;

//Spawn Delay to wait for server.
private void Update()
timer -= 1 * Time.deltaTime;
if(timer <= 0)
timer = 1000;


//Spawns character on the network.
public void CmdSpawnPlayer(int playerIndex)
GameObject chosenCharacter = playerPrefabs[playerIndex];
GameObject go = Instantiate(chosenCharacter, new Vector3(0, 1, 0), Quaternion.identity) as GameObject;
NetworkServer.SpawnWithClientAuthority(go, connectionToClient);



And i have another script that’s on the object being instantiated on the network that should sync the components to give the player control over themselves.


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;

public class SyncComponents : NetworkBehaviour {

public MonoBehaviour[] componentsToEnable;
public GameObject enableCam;

private void Start()
if (!isLocalPlayer)


for (int i = 0; i < componentsToEnable.Length; i++)
componentsToEnable[i].enabled = true;




What seems to be happening is that when it goes to enable the components it wont because it does not have LocaPlayerAuth for some reason i cant understand. The object being spawned has LocaPlayerAuth ticked so that shouldn’t be the issue. Any help is greatly appreciated.


  • Liked by
1 on July 8, 2017

Is the network identity component set to local?

on July 8, 2017

Yes, yes it is.

Show more replies
  • Liked by
0 on November 3, 2018

It does not work to me if the player is the host.
Any idea why?

  • Liked by