Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Mouse cursor appearing/disappearing

Discussion in '5.3 Beta' started by makeshiftwings, Oct 9, 2015.

  1. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    It appears that 5.3 fixes a long standing bug that would cause the mouse cursor to fail to appear in the editor after being switched off and on, but introduces some new bug that breaks code that had previously tried to get around the original bug. I mention this because some other assets had written code to work around the original bug (UFPS in my case) which now actually do the opposite and cause the mouse cursor to disappear instead of fixing it. Didn't see it in the release notes but if anyone else is noticing the mouse cursor suddenly disappearing in 5.3 this could be why.

    Previously this code didn't actually work while in the editor because of a bug:
    Code (csharp):
    1. Cursor.visible = false;
    2. //... some frames later...
    3. Cursor.visible = true;
    It would usually just leave the cursor invisible forever. But now that has been fixed apparently in 5.3.

    UFPS got around it by doing this:
    Code (csharp):
    1. Cursor.SetCursor(InvisibleCursorImage);
    2. //... some frames later...
    3. Cursor.SetCursor(VisibleCursorImage);
    But now that code doesn't work anymore and just leaves the cursor invisible forever.
     
  2. omegallah

    omegallah

    Joined:
    Mar 27, 2013
    Posts:
    4
    Are you using NGUI by chance? If you are, you need to disable NGUI's cursor modification stuff, because you're managing the cursor with UFPS. -- This was the cause of all of my problems with the cursor.

    If you ARE using NGUI;
    Essentially NGUI's (from like 3-4 versions ago it was first introduced) has a thing to switch between "mouse" "controller" and "keyboard" and it constantly toggles the cursor based on mouse clicks and keyboard, if any NGUI panels are up. I forget where it is right now but you can search in ngui code for the setcursor stuff.
    basically, every time you press wsad and click to fire, it would toggle betwen input modes. Which you absolutely don't want in an FPS.