Unable to use setCursor to use a custom mouse pointer

Hi, I am using the following code to change the cursor:

using UnityEngine;
using System.Collections;

public class replaceCursor : MonoBehaviour {

    public Texture2D cursorTexture;
    CursorMode cursorMode;
    Vector2 hotSpot;

	// Use this for initialization
	void Start () {

	}
	
	// Update is called once per frame
	void Update () {
	
	}

    void OnMouseEnter()
    {
        cursorMode = CursorMode.Auto;
        hotSpot = Vector2.zero;	
        Cursor.SetCursor(cursorTexture, hotSpot, cursorMode);
    }

    void OnMouseExit()
    {
        Cursor.SetCursor(null, Vector2.zero, cursorMode);
    }
}

But this doesn’t seem to work, I just get the standard cursor, can someone explain what I might have done wrong?

Well, it seems that OnMouseEnter wasn’t even being called, moved it to Awake and it works fine! thanks Baste :slight_smile: