- Home /
Question by
JollyCoke · May 03, 2016 at 06:54 PM ·
networkingspawning
Network.Spawn. Not Spawned on clients except for host.
Hi, when I try to spawn an object, the object is only spawned on the host. I've tried everything now, and I cant seem to find an answer on Google. Pls help me :) This is my code:
public override void SetActive(bool value)
{
base.SetActive(value);
if (value)
{
if (isLocalPlayer)
{
CmdSpawn();
}
}
}
[Command]
void CmdSpawn()
{
GameObject go = (GameObject)Instantiate(hookPrefab, transform.position, Quaternion.identity);
hook = go.transform;
NetworkServer.SpawnWithClientAuthority(go, gameObject);
}
Comment