- Home /
Client can't spawn GameObject's
I have looked that the unity documentation on spawning things from a client and this is pretty much the same without the bullet/weapon firing.
Initiates the checking inventory and the dropping.
[Client]
public void ClientDropInput(int itemIndex)
{
GameObject item = invSlots[itemIndex];
if (item.GetComponent<Item>().itemClass.itemType != ItemClass.ItemTypeEnum.None)
{
CmdDrop(itemDatabase[item.GetComponent<Item>().itemClass.itemDatabaseIndex], itemIndex);
}
}
Handles dropping from the client to the server
[Command]
void CmdDrop(GameObject item, int index)
{
print(NetworkServer.active);
GameObject go = (GameObject)Instantiate(item,dropLoc.position, dropLoc.rotation);
NetworkServer.Spawn(go);
}
This code works fine for the host but the client never calls the code. The items do have network identity's on them. Everything else works as intended. I have googled as much as one can google for the specific things that aren't working.
Also as you can see under the [Command] code there is a print that checks to see if the NetworkServer is active or not, on the host this prints out true and on the client it prints out false not sure if that has a significance to the problem.
Any help with this will be appreciated -Mike
{BU$$anonymous$$P} Still could use the help if anyone is willing.