My PlayerObject has the following script:
[Command]
void CmdFire()
{
// Create the Bullet from the Bullet Prefab
var bullet = (GameObject)Instantiate(
bulletPrefab, cameraRig.position, cameraRig.rotation);
// Spawn the bullet on the Clients
NetworkServer.Spawn(bullet);
// Destroy the bullet after 2 seconds
Destroy(bullet, 2.0f);
}
The bullet prefab has a networkid, networktransform and its script is from networkingbehaviour. Prefab is registered in the NetworkManager. Everything works fine if the host-client runs the CmdFire() function. The bullet will spawn for all Clients.
But if I execute the CmdFire() function on a client, the code is never executed on the server, even though it should. No object is created on the server, not even for the host-client.
I am using Unity 2017.3.