(1). First find two pictures to change the icon
(2). Drag into the Unity project and set the following properties:
(3). Create two scripts the contents are:
The script needs to inherit from the Singleton class, so that the corresponding properties can be removed. The script is mainly used for storing the replacement mouse, dragging to the corresponding object, you need to drag and drop the replacement icon in
Public class Oftenuseconstscripts:monosingleton<oftenuseconstscripts> { // hand mouse style Public texture2d Handcursorstyle; // mouse style for arrows Public texture2d Arrorscursorstyle;}
The main operation of this script is to change the mouse when the mouse is moved to the corresponding range.
// This class represents the corresponding change in the icon when the mouse is moved to the appropriate range . Public class Changecursor:monobehaviour, Ipointerenterhandler, ipointerexithandler{ publicvoid Onpointerenter (pointereventdata eventData) { cursor.setcursor (OftenUseConstScripts.Instance.HandCursorStyle, Vector2.zero, Cursormode.auto); } Public void onpointerexit (pointereventdata eventData) { cursor.setcursor (OftenUseConstScripts.Instance.ArrorsCursorStyle, Vector2.zero, Cursormode.auto);} }
The above can be achieved by moving the mouse to the corresponding range of time to replace!!!!!
(2). Drag into the Unity project and set the following properties:
Replace the mouse icon with the icon in Unity