Does anyone know how to make a cursor in a 2d unity game move like a regular one would? If so, please respond.

I was trying to make a script to follow a custom cursor for a 2d game I’m making in the 2020.2 version of unity and I got the cs1002 error (mainly where it says ScreenToWorldPoint{ Input.mousePosition} ) and I can’t figure out what I did wrong. If anyone has any suggestions to make a change to the code, please respond.

Here’s my code:

`public class custom_cursor : MonoBehaviour
{
Vector2 targetPos;
// Should prevent the cursor the cursor that naturally exists without the input of a 3rd party from showing up.
void Start()
{
Cursor.visible = false;
}

// Should make the cursor image move around the screen of the game.
void Update()
{
    targetPos = Camera.main.ScreenToWorldPoint{ Input.mousePosition}
    transform.position = targetPos;
}

}`

Unity has support for overriding the actual cursor, provided you use a 32x32 image using Cursor.SetCursor().

This is by far the best way to handle it, as having a cursor object follow the cursor is framerate dependent.