public Button Shot;
public float range = 15;
public float damade = 21;
public float fireRate = 1;
public ParticleSystem muzzleFlash;
public AudioClip shotSFX;
public AudioSource _audiosorse;
private float nextFire = 0f;
public Camera _cam;
private void Start()
{
Shot = GameObject.Find("Shot").GetComponent<Button>();
Shot.onClick.AddListener(Shoot);
}
public void Shoot()
{
RaycastHit hit;
if (Physics.Raycast(_cam.transform.position, _cam.transform.forward, out hit, range))
{;
Debug.Log("Popal");
}
}
How to make shooting on android?
I watched a lot of videos but they were all on the computer.
One of the problems is that in Update I have to write Input.GetButtonDown but that only works on PC. And input.Touch is not suitable, or I’m not using it correctly.
I was able to do partly working shooting, but it happens once when the button is pressed, but it is necessary while I hold down the button, and for this I need to write lines in Update.