Top Down 2D shooter pointer mouse aim

Hello guys!
I’m a beginner and I’m doing a 2D Top Down shooter and I wanted to do a pointer mouse aim [I don’t know if that is what’s called but is basically, where the mouse cursor is in the screen(the cursor shouldn’t be shown), is where the aim would be at the screen], so I would be very gratefull if someone completed my script (it is a gun game).

Here is my script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BasicMovement : MonoBehaviour

public Animator animator;
public GameObject Crosshair;

void Update()

    Vector3 movement = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0.0f);


    animator.SetFloat("Horizontal", movement.x);
    animator.SetFloat("Vertical", movement.y);
    animator.SetFloat("Magnitude", movement.magnitude);

    transform.position = transform.position + movement * Time.deltaTime;


private void MoveCrosshair()
    Vector3 aim = new Vector3(Input.GetAxis("AimHorizontal"), Input.GetAxis("AimVertical"), 0.0f);

    if (aim.magnitude > 0.0f) {
        aim *= 0.4f;
        Crosshair.transform.localPosition = aim;


Thanks guys!

Check out this old question I posted before Unity had the 2D mode:

You could either try my own solution, or the one posted by @Munchy2007.