Hey all, I’ve been learning how to work with the networking code of unity, but I’m having some problems.
I’m building the player from multiple prefabs, it all starts with a single ‘hardpoint’ which can slot a single part of a space ship. parts have one or more hardpoints, which in turn can slot more parts, so i created a beautiful piece of code first converting json to the core information of the parts to an object, which in turn gets turned into a space ship. in single player it all works beautifully, but in multiplayer it seems that the spawned children don’t have client authority, and thus, they can’t spawn other objects
Spawn code:
[Command]
void CmdSpawn()
{
heldInstance = Instantiate(holds, transform.position, transform.rotation) as GameObject;
heldInstance.transform.SetParent(transform);
NetworkServer.SpawnWithClientAuthority(heldInstance, transform.root.gameObject);
}
Pretty straight forward, this code gets called from the hardpoint object, which, as i’ve said, is a child of the prefab spawned (in this case the variable ‘holds’, holds the prefab the hardpoint should spawn. Can anyone shed some light on what’s happening here? Because im pretty lost at this point.