I’ve made loads of guns and they have been fine but this one doesn’t seem to shoot out it just stays in front of my muzzle (empty gameobject) and won’t fire i’m pretty sure ive checked everything and I don’t know if you could give me some tips on what it could be causing this would be greatly appreciated thanks!!!
using UnityEngine;
using System.Collections;
public class Shoot : MonoBehaviour {
public float bulletForce;
public GameObject bullet;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
if(Input.GetMouseButton(0))
{
GameObject obj = Instantiate(bullet, transform.position, transform.rotation) as GameObject;
obj.rigidbody.AddForce(transform.forward * bulletForce);
Destroy(obj, 1f);
}
Debug.Log (transform.forward);
}
}