How to spawn objects?
Hi. I have a problem with spawning objects. I have a bullet with commponents NetworkIdentity (server only and local player authority are disabled) and NetworkTransform. And in player's gameObject I have a script with this function:[Command] public void CmdFire (GameObject barrel, GameObject bullet) { GameObject ball = Instantiate(bullet, barrel.transform.position, barrel.transform.rotation) as GameObject; NetworkServer.Spawn(ball); }
And... it doesn't work. This function is calling by other script. Bullet is spawning only on client which was shooting. Other players can't see this bullet.
And when bullet hit in other player I made ClientRPC function which making damage to this player. But it doesn't work. When host hit client I got "Did not find target for RPC message for 3" error. But when clinet hit host I got "ClientRpc call on un-spawned object" error.
So how to spawn this object?