Trying to make an object follow my cursor

I’m using csharp, and I’m trying to make “StaticObject” follow my cursor. Is there something wrong with my code or do I need to try a new method?

public class Cursor : MonoBehaviour
{
private Vector2 StaticSprite;
void Start()
{
StaticSprite = new Vector2(0.0f, 0.0f);
}

// Update is called once per frame
void Update()
{
    Vector2.MoveTowards(StaticSprite, Input.mousePosition, 30f);
}

}

how to make a game object follow the mouse cursor - Questions & Answers - Unity Discussions see if this can help you.