At the Multiplayer fps tutorial, shooting is not working. [Solved]

Updated on July 12, 2017 in [A] Brackeys Courses
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
0 on July 12, 2017

When i shoot from the other client which is not the Host, i don’t get in console the Debug.Log:

 
void Update()
 {
 if (Input.GetButton("Fire1"))
 {
 Shoot();
 }
 }
 
[Client]
 void Shoot()
 {
 RaycastHit _hit;
 
if (Physics.Raycast(cam.transform.position, cam.transform.forward, out _hit, weapon.Range, layerMask))
 {
 if(_hit.collider.tag == PLAYER_TAG)
 {
 CmdPlayerShoot(_hit.collider.name);
 }
 }
 }
 
[Command]
 void CmdPlayerShoot(string _ID)
 {
 Debug.Log(_ID + " has been shot.");
 }
  • Liked by
Reply