I am creating a script that’ll make my gun shoot ready made bullets. I have an invisible spawnpoint infront of the gun. (FPS)
Here’s the script:
var BulletPrefab:Transform;
var force : float = 2000;
function Update ()
{if(Input.GetMouseButtonDown("Fire1"))
{var bullet = Instantiate(BulletPrefab,
GameObject.Find("spawnPoint").transform.position,
GameObject.Find("AK-47M").transform.rotation);
bullet.rigidbody.AddForce(bullet.transform.forward * force);
}
}
But I get the error message: Assets/FPSScripts/shoot.js(5,25): BCE0017: The best overload for the method ‘UnityEngine.Input.GetMouseButton(int)’ is not compatible with the argument list ‘(String)’.
And i don’t get how i should make it shoot when i press leftclick in my mouse. anyone willing to help?