I’m creating a top down shooter for mobile, with only a single stick controller that move my player and changes his direction, i have also a “Fire” button that should make the rifle shoot until it is pressed but with a specific fire ratio.
I tried Coroutine, and it shoot only when i press and when i release (i even tried to change the event in event trigger between pointer click and pointer down), then i tried this following code:`public void OnClickFire()
{
if(Time.time > NextFire)
{
NextFire = Time.time + FireRate;
Instantiate(bullet, transform.position, transform.rotation);
}
}`
but again it won’t work.
I just want to press the button and shoot, limited by the only Fire Ratio, not by the click of the button!
Thank you!