I am trying to make a bullet but before I set it as a prefab, I want to set the components for it. When running the game, the bullet just keeps falling down even though I have set the gravity to 0. Below, is the code I used and a screenshot of my inspector. Any help would be appreciated!
public class PlayerBullet : MonoBehaviour
{
public float speed = 7.5f;
public Rigidbody2D rb;
void Start()
{
}
void Update()
{
rb.velocity = transform.right * speed;
}
private void OnTriggerEnter2D(Collider2D collision)
{
Destroy(gameObject);
}
}