Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Hardware cursor not working in Standalone/Web

Discussion in 'Editor & General Support' started by holyfuzz, Apr 15, 2013.

  1. holyfuzz

    holyfuzz

    Joined:
    Nov 16, 2010
    Posts:
    21
    Hello,

    I'm trying to get hardware cursors working in my game. I set the "Default Cursor" under "Player Settings" to a texture whose type is set to "Cursor".

    This works fine in the editor, but does not work in either standalone or webplayer builds. I'm testing on a Mac.

    Is there something I'm missing that I need to do?

    Thanks!

    Walt
     
  2. holyfuzz

    holyfuzz

    Joined:
    Nov 16, 2010
    Posts:
    21
    Is no one else having this issue?
     
  3. FlaxSycle

    FlaxSycle

    Joined:
    Oct 6, 2012
    Posts:
    232
    Yeah I get this too... my work around was to use Cursor.SetCursor to set the cursor in script. This seems to work in the build.

    The strange thing is, SetCursor isn't working for me in the editor, and setting the cursor in Player Settings doesn't work in the build, which is frustrating when I have code to change the cursor in game, but can only see it working when I do a build.
     
  4. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    For me, using the hardware cursor works in Editor, but not in the WebPlayer.

    In Editor:

    $cursor_in_editor.png

    However, if I use the CursorMode.ForceSoftware mode, it works in WebPlayer (but is having the classic "software" lag).

    I'm using:

    Code (csharp):
    1. Cursor.SetCursor(cursorTexture, hotSpot, cursorMode);
    With Windows build I'm seeing a strange artifact:

    $cursor_windows.png
     
    Last edited: Oct 30, 2013
  5. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Just found the answer in another thread. ^^

    The texture type of each texture used as a cursor must be set to "Cursor" via the texture importer. Now it works OK in both the WebPlayer and Windows builds.

    ps. My cursor images reside in the Resources folder, so no problem with that.
     
    Un3mp and imDanOush like this.
  6. Danor

    Danor

    Joined:
    Jul 27, 2014
    Posts:
    4
    with SetTextureSettings ?
     
  7. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410