Hello. I know this question has already been asked a million times, but none of the posts that I have found seem to be working for my situation. I’m trying to make the game fire a bullet when the player left-clicks. The bullet is a prefab, and I’m trying to instantiate it. Here’s my code:
#pragma strict
function Start () {
}
function Update () {
//Fire a bullet when the player clicks
if (Input.GetMouseButtonDown(0)){
var bullet_prefab: GameObject;
Instantiate(bullet_prefab,transform.position,transform.rotation);
}
}
And here’s a screenshot of my project so you can see how the prefab is set up:

And here’s the player’s GameObject so you can see how I have the script put on there, in case that helps.
