Setting custom mouse cursors for 2D and 3D GameObjects
Cursor icons are often used to indicate the nature of the interaction that can be done with the mouse. Zooming, for instance, might be illustrated by a magnifying glass; shooting, on the other hand, is usually represented by a stylized target. In this recipe, we will learn how to implement custom mouse cursor icons to better illustrate your gameplay – or just to escape the Windows, macOS, and Linux default UI:

Getting ready
For this recipe, we have prepared the folders that you'll need in the 02_06
folder.
How to do it...
To make a custom cursor appear when the mouse is over a GameObject, follow these steps:
- Create a new Unity 2D project.
- Import the provided folder, called
Images
. Select theunity_logo
image in the Project panel, and in the Inspector change the Texture Type to Sprite (2D and UI). This is because we'll use this image for a 2D Sprite GameObject, and it requires this Texture Type (it won't work with the Default type).
- Add a
2D...