Allow native cursors to be used at runtime too

Hello,

We are making UI-heavy game, but using native cursors (from the OS). And wondering why is it impossible to use cursor keywords at runtime, and only in editor?

Note : Cursor keywords are only available in the Editor UI. Cursor keywords don’t work in runtime UI. In runtime UI, you must use a texture for custom cursors.
(source: Unity - Manual: USS common properties)

It would be really nice to get the OS cursors directly from USS keyword.

Thank you

1 Like

The main reason that these cursors are editor only is that they intend to mirror the UnityEditor.MouseCursor class which is functionality that is not part of the Runtime. Some of these icons aren’t standard OS icons and so the images are bundled as part of the Editor binaries and would need to be added to our runtime Style Sheets as well.

Figuring a good way to extract those resources and make sure they don’t bloat the build size when not needed is the main challenge that mean this wasn’t an easy task.

As a suggestion, you could provide your own cursor textures and list them as USS Variables that can be used in place of the builtin “enum” values in your USS cursor properties.

2 Likes