Defining and Organizing Cursors

August 20, 2020

·

Cursory

Cursory loads a predefined set of cursors on game start, so it is important to understand the file types, formats, and procedures that need to be followed in order for a cursor to be loaded. These cursors can be defined in the Cursors section of the Project Settings.

Cursor Types

Cursory supports all common cursor types supported by Unreal Engine 4, subject to limitations imposed by the target platform.

  • Windows - .ani, .cur, .png
  • Mac - .tiff, .png
  • Linux - .png

Cursors are loaded in this order. For example, if both Cool.ani and Cool.png exist in the same folder, only Cool.ani will be loaded.

Cursor Locations, .Uassets, and Cooking

Cursory will look for cursors in the path that you specify in Project Settings, but that path must be within your game's Content directory. In addition, there are a few caveats to keep in mind.

First, when writing out the path to the cursor, do not specify the file extension. As noted above, the system will look through the relevant folder for a cursor that first matches the priority list.

// WRONG: Slate/Cursors/Cool.png
Slate/Cursors/Cool

Second, note that unlike for many assets, the hardware cursor system does not depend on .uasset files. Instead, it looks for the raw cursor file (.ani, .cur, etc.). Accordingly, having a .uasset can unnecessarily clutter your Content folder. For this reason, it is a good idea to place your raw cursor files in the Content/Slate/~ subfolder, which does not automatically create .uasset files out of raw assets placed within.

Third, and on a related note, raw cursors are not automatically cooked because they are not .uasset files. Instead, you need to manually indicate in Project Settings that you want your cursor folder to be cooked. However, we can skip this by placing content in the Content/Slate/~ subfolder, which is always cooked.

Organize Cursors

Cursory gives you the power to organize your hardware cursors in arbitrary ways using GameplayTags. For example, if you had a game with an ice breaker game, you could have three cursors for specific situations:

  • Floating above ice
  • Floating in midair
  • Breaking ice

Or maybe you would structure it a different way. Ultimately, Cursory places no limits on your imagination!



© Mowgl33 2020.