The previous recipe demonstrated how to change the mouse pointer for 2D and 3D GameObjects receiving OnMouseEnter and OnMouseExit events. Unity UI controls do not receive OnMouseEnter and OnMouseExit events. Instead, UI controls can be made to respond to PointerEnter and PointerExit events if we add a special Event Trigger component to the UI GameObject:
Figure 2.23 – Mouse pointer as a magnifying glass cursor
In this recipe, we'll change the mouse pointer to a custom magnifying glass cursor when it moves over a UI Button GameObject.