The host calls the server RPC and destroys the object, but the client doesn’t even enter the server RPC. What am I doing wrong? note( I have used NetworkBehaviour)
code:
private void Collect(GameObject hit)
{
hitGameObj = hit;
Inventory[hitGameObj.name] = true;
string str = "";
foreach (var p in Inventory)
{
str += p.Key + ": " + p.Value + "\n";
}
DestroyServerRpc();
}
[ServerRpc(RequireOwnership = false)]
private void DestroyServerRpc()
{
hitGameObj.GetComponent<NetworkObject>().Despawn();
}