The bullet wasn’t moving forward (that sprite was used to debug?). This script is what I use to make this function:
using UnityEngine;
using UnityEngine.EventSystems;
public class Shooting : MonoBehaviour
{
public float bulletSpeed = 10f;
public int damage = 40;
public Rigidbody bullet;
public Transform firePoint;
public void Fire()
{
Rigidbody bulletClone = (Rigidbody) Instantiate(bullet, transform.position,transform.rotation);
bulletClone.velocity = transform.TransformDirection(new Vector3(0, 0,bulletSpeed));
}
void Update ()
{
if (Input.GetButtonDown("Fire1"))
Fire();
}
}```
