I`m making a game which is controlled by Xbox 360 gamepad.
I want to instantiate an object when I touch the stick. Just one sphere, not more (at least before I released my stick).
I created a prefab and an Instantiation script.
Then I tried to limit my Instantiation with Time.time (just like in tutorials, with Firerate):
void Update ()
{
if (Input.GetAxisRaw ("Horizontar") != 0 || Input.GetAxisRaw ("Verticar") != 0 && Time.time > nextFire)
{
nextFire = Time.time + fireRate;
Instantiate(target1, transform.position, transform.rotation);
transform.LookAt (target1);
stick = false;
}
None of this has worked, I get zillions of spheres as long as I hold the stick tilted.
What am I doing wrong?