Top down shooter 2D aim with mouse

Hello guys!
I’m a beginner and I wanted to aim with the mouse but I don’t know how to do it.
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 for the help!

you can follow this 1 a 2d shooter game with mouse aim and here it is in the asset store