0
votes

I have windows application (child's game built with Unity) that I want to set a custom cursor for - I only have the binary for the application, it's not my code. The application runs full screen and appears to use the windows cursor, the cursor is too small to be easily seen by children.

I would like to create a much bigger custom mouse cursor from a png and use that in the game. (much bigger than even the windows accessibility cursors)

So far I have tried:

  1. Using the windows 10 control panel to set the cursor for the whole OS to be a 160x160px ico file. Windows then shrinks the image down to a much smaller size (64x64?).

  2. Writing a windows forms app in C# that uses my PNG as a custom cursor using code like:

    IntPtr ptr = myPng.GetHicon();
    myCursor = new Cursor(ptr);
    this.Cursor = myCursor;
    

This partially works: the cursor is as big as I want, but it only changes the cursor for my application, not the OS. (this is the expected behaviour of these functions).

  1. Using SetSystemCursor from user32.dll in my C# app to set the system wide cursor to the one built from my PNG as in 2. This changes the system wide cursor but is back to being shrunk down by windows to a small size as in 1 with the ico.

So, is what I want to do possible? What approach have I missed?!

1
Depending on the technology that Unity uses to set the cursor, you may be able to create a custom cursor at runtime (CreateCursor) and set that for the window class associated with the application (SetClassLongPtr). - IInspectable
You might need to do a injection of code (see other places on line how to inject code to a existing unity game) and do a Cursor.SetCursor( call using your custom texture. - Scott Chamberlain

1 Answers

0
votes

You would need to use a 3rd party utility such as MouseChanger, which is freeware available from sourceforge