In my code, Bullets are spawn inside BulletSpawn Countie function looks like this
IEnumerator BulletSpawn()
{
isFireCompleate = false;
var bullteIns = Instantiate(Bullet, BulletSpawnPosition.transform.position, transform.localRotation);
Destroy(bullteIns, 5f);
yield return new WaitForSeconds(FireRate);
isFireCompleate = true;
}
And I am trying to add networking
I think for bullets: i want to spawn bullets inside the server side. and Using NetworkServer.Spawn(bullteIns)
, Sync bullet spawn to all the clients & Synchronize Damage (variable) using [SyncVar]
I’m following This presentation (Unite 2014 - New Unity Networking in 5.x).
[Command]
IEnumerator CmdBulletSpawn()
But with my countie function. i am not able to do that.
Error: Command function
[PlayerInputController:CmdBulletSpawn]
cannot be a coroutine
My Question is, How can i spawn bullets in the server side in this case. Is there any method beside using Command. or do i need to change my code.