Changing cursor using 2D sprites

I would like to change my cursor in the game, using 2D sprites. The problem is that the script I used is working only on 2D game, not on 3D. Somebody help?

Here is the script i atached to the 2D sprite:

public class CursorScript : MonoBehaviour {

	// Use this for initialization
	void Start () {
		Cursor.visible = false;

	// Update is called once per frame
	void Update () {
		Vector2 cursorPos = Camera.main.ScreenToWorldPoint (Input.mousePosition);
		transform.position = cursorPos;

I would really apreciate some help. Thx!

For custom cursors I would rather recommend using the Cursor API, specifically the Cursor.SetCursor() call. Note that you will have to set your cursor images’ texture type as “Cursor” rather than “Sprite” to use it with this API.

However, if you really want to stick with the above approach for some reason, you will either have to map the mouse position to an appropriate 3D point visible by the camera, or use the sprite as UI element on a canvas, and map the mouse position to the appropriate point on the canvas. However, I don’t recommend this approach, because there will always be a small difference between the position of the cursor image and the real position of the mouse pointer. This problem is correctly handled by the Cursor API, and that’s why I recommended it first.