void shoot() { laserShoot.Play(); RaycastHit hi; if (Physics.Raycast(fpscam.transform.position, fpscam.transform.forward, out hi, range)) { Debug.Log(hi.transform.name); target Target = hi.transform.GetComponent <target>(); if (Target != null) { Target.Takedamge(damage); } } }