Hello!
I have been working on a 2d space shooter, but recently, I found an error
Whenever I play the game, I dont need to press the b key, lasers fire regardless.
Here is my code
using UnityEngine;
using System.Collections;
public class Firing : MonoBehaviour {
public GameObject laser;
public GameObject bulletpositiona;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
if (Input.GetKey("b")) ;
{
GameObject bullet = (GameObject)Instantiate(laser);
bullet.transform.position = bulletpositiona.transform.position;
}
}
}
Thank you!!