UGTK cat mascotUGTKengine within an engine Request access

UGTK / Toolkit / Ui Module / Mouse Over System Completed

Ui Module — UGTK

Mouse Over System

Summary

The Mouse Over System swaps the hardware cursor while the pointer is over an object, and puts the system one back when it leaves.

It is the "this is clickable" hint: a hand over a button, crosshairs over a target, a magnifier over a zoomable map. One component per object, no script to write.


Content


Modules Dependencies

None inside UGTK. It uses Unity's EventSystem and Cursor.SetCursor.


Setup

  1. Add Mn_MouseOver to the object that should change the cursor.
  2. Assign Cursor Texture in the inspector.

The object has to be reachable by the EventSystem, which means one of two things: a Graphic with Raycast Target on if it lives on a canvas, or a collider plus a Physics Raycaster on the camera if it is a world object. Without that the pointer events never arrive and the component does nothing at all — there is no error to tell you.


How To Use

There is nothing to call: the component reacts to the pointer entering and leaving on its own.

Three things are worth knowing before you ship it.

Keep the texture small. A cursor is drawn by the OS at its native size, so a 512×512 image does not give a crisper pointer — it gives a huge one.


Testing Scene

The inspector also carries an Editor Test Tools block that simulates the pointer entering and leaving, so the texture can be checked without entering Play Mode and hovering by hand. It previews the assigned cursor at its real size and warns about the two traps above — no texture assigned, and Read/Write disabled.


Technical Info

Path Content
Scripts/Mn_MouseOver.cs The component. Implements IPointerEnterHandler and IPointerExitHandler; applies the texture on enter and restores the system cursor on exit
Scripts/Editor/Mn_MouseOverEditor.cs Inspector: cursor preview, the Read/Write check, and the two simulate buttons

© 2026 Marcello De Bonis. All rights reserved