Unity 2D: move towards mouse and through mouse

Hi, I am a noob, and I have looked everywhere for a script that moves a bullet(or object) towards the mouse and through the mouse position. My game is a 2D top down shooter using the x and y coordinates(basically no gravity). Can anyone point me in the right direction to make my bullets move this way.

Here is the basic code. You need to have a ‘prefab’ game object variable at the top of the file and an ‘amount’ variable that defines how much force to apply. Start with ‘amount’ set to 500, then adjust. Note your sprite should have the forward of your bullet facing right when the rotations is (0,0,0).

var pos = Camera.main.WorldToScreenPoint(transform.position);
var dir = Input.mousePosition - pos;
var angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
var rotation = Quaternion.AngleAxis(angle, Vector3.forward); 
var go = Instantiate(prefab, transform.position, rotation);
go.rigidbody2D.AddForce(transform.right * amount);