Question by
Mustafa_C · Sep 19, 2018 at 05:58 PM ·
multiplayershootingmultiplayer-networking
Bullets not moving on client screen.
I have made a 2D multiplayer shooting funtion:
[Command]
void CmdFire()
{
// Create the Bullet from the Bullet Prefab
var bullet = (GameObject)Instantiate(
bulletPrefab,
bulletSpawn.position,
bulletSpawn.rotation);
var direction = bullet.transform.right;
if (!facingRight)
{
direction = -bullet.transform.right;
}
// Add velocity to the bullet
bullet.GetComponent<Rigidbody2D>().velocity = direction * bulletSpeed;
NetworkServer.Spawn(bullet);
}
Unfortunately it only shoots on the server screen. I have noticed that one of the characters also does not flip its sprite so it cannot shoot the other way.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612174923im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
RPC sending Failed 0 Answers
Multy Player both players are moving 0 Answers
Unet: Is the position in a GameObject Inspector hierarchy important 0 Answers