Search Unity

Users complaining that mouse doesn't work anymore

Discussion in 'Windows' started by mr_zog, Jan 30, 2017.

  1. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    We released an update with Unity 5.5.0p3 (64-bit) and several users have complained, that input isn't working for them anymore.

    According to the user reports, it seems to be Windows 10.

    The Microsoft backend shows these errors (weren't there before the update!):

    Code (csharp):
    1. INVALID_POINTER_WRITE_c0000005_UnityPlayer.dll!std::vector_struct_InputBuffer::PointerInput,class_std::allocator_struct_InputBuffer::PointerInput___::push_back
    Code (csharp):
    1. FATAL_USER_CALLBACK_EXCEPTION_c000041d_UnityPlayer.dll!InputBuffer::Add
    Code (csharp):
    1. INVALID_POINTER_WRITE_c0000005_UnityPlayer.dll!std::vector_struct_InputBuffer::InputData,class_std::allocator_struct_InputBuffer::InputData___::push_back

    A am not able to reproduce it with our hardware and I currently don't have any callstacks in the MS backend.
    I am also not sure, if it's related, as I cannot reproduce, but could it be related to touchpad + mouse plugged in or maybe the mouse lock?
    We are communicating with our users to try to find more similarities and to clarify, if input doesnt work in general (game menu + 3d gameplay) or only in the 3d scene (mouse lock).

    If you have anything we should ask them, please let me know!
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    This error looks very weird.
    Can you check Player settings for which input source you are using?
    Also, can your users reliably reproduce it?
     
  3. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    Inputsource = Swap Chain Panel.
    I figured, if you use this, touches to overlaying UI elements, e.g. Vungle ads, don't go down to the game UI.
    Should we try a different setting?

    Regarding user reporting: We are trying to get replies from them, but mostly they are frustrated and lost. But I'll post as soon as we get something.
     
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    Using Independent input source should also work the same with respect to overlays. It is also likely to prevent such errors. Sadly, that doesn't explain, why they happen in the first place. They shouldn't.
     
  5. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    We'll make a build tomorrow and see if the error goes away, I'll report back.
     
  6. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    Made some builds with "Independent input source" and that won't work, because we lock the mouse in the 3d scene, and it seems that that doesn't work:
    The cursor gets hidden, yes. But you can navigate out of the window ... even if the game is fullscreen ... moving the mouse down suddenly brings up the task bar.

    So I guess we have no other option than using Swap Chain Panel, as Core Window says:
    and we use XAML.
    https://docs.unity3d.com/ScriptReference/PlayerSettings.WSAInputSource.html
    ???
     
  7. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    Yes, sounds like you are limited to this option.
    Do you have any native plugins? I'm trying to guess here what's causing the failure...
     
  8. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    So far we use:
    * Unity IAP,
    * Vungle,
    * WSANative (only ads).

    If I where to pick one, I'd say Vungle. We have observed some instabilities with it (on every platform it supports, not only Windows Store).

    What do you think is causing the issue?
    Some kind of wrong script execution order?

    That said, I have to note, that we have been using the same SDKs for quite some time, and the error now occured, since we upgraded from 5.3.7 to 5.5 ...
    One thing I fell over was e.g., that you guys changed the behavior of a locked mouse. So maybe you changed more of the input code?
    Also, the generated project looks a bit different than before.
     
  9. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    Is this being further investigated?

    We get more and more users complaining ...

    I now have some callstacks, if that helps:

    Code (csharp):
    1.  

    Code (csharp):
    1.  
     
  10. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    Did you do any custom modifications to generated MainPage.xaml.cs code?
    The only reason I can think of currently is memory corruption.
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    That helps a lot. I'll try looking at it. Anyway, did using independent input source not help? These stacktraces show that it's not used.

    EDIT: I inspected the code in the stacktrace and there's nothing suspicious that could cause this. This looks more and more like a memory corruption. Have you ever been able to reproduce this yourself?
     
  12. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    Thanks for the replies.

    @Repro: No, we haven't been able to reproduce the issue.
    I'll do some more investigation and try to find out, if it 's some specific devices.

    @MainPage.xaml.cs: I only added this line
    Code (csharp):
    1.  BannerAdManager.Initialise(GetSwapChainPanel());
    at the end of the MainPage constructor. It belongs to the WSANative extension, where we only use the MSAds and Adduplex ads. All that does is add a child to the grid.

    @Independant Input Source: This seems broke if you want to lock the cursor, so we cannot use it :(
    The cursor gets invisible, but not locked to the center ...
     
  13. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    Actually I think you can, but there is one extra bit that you need to do yourself. Cursor locking is done by setting cursor to null. When you use Independent Input Source, we null it on IIS, but not on CoreWindow. If you set PointerCursor to null on CoreWindow yourself in MainPage.xaml.cs somewhere, it should work.
    Actually, I think it is a bug that Unity does not null cursor on CoreWindow with IIS enabled, feel free to report it.
    Granted, this does not brig as to root cause of this. Using IIS should solve this exact crash, but it might be just a slight mitigation from the actual problem that still exist and might pop elsewhere.
     
  14. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    Thanks for pointing me in that direction, I will do some tests ASAP and report back.
     
  15. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    This is the current code I ended up with.
    First tests suggest that it should work.

    Will do some more testing next week and we'll then release an update and see if the bug goes away.
    Feel free to integrate this behaviour into the engine!

    Code (csharp):
    1.  
    2.         public static void SetCursorLockMode(CursorLockMode mode)
    3.         {
    4.             Cursor.lockState = mode;
    5.  
    6.             switch(mode)
    7.             {
    8.                 case CursorLockMode.Locked:
    9. #if NETFX_CORE && UNITY_WSA_10_0
    10.                     UnityEngine.WSA.Application.InvokeOnUIThread( () =>
    11.                     {
    12.                         Windows.UI.Xaml.Window.Current.CoreWindow.PointerCursor = null;
    13.                     }, true );
    14. #endif
    15.                     break;
    16.  
    17.                 case CursorLockMode.Confined:
    18.                     break;
    19.  
    20.                 case CursorLockMode.None:
    21. #if NETFX_CORE && UNITY_WSA_10_0
    22.                     UnityEngine.WSA.Application.InvokeOnUIThread( () =>
    23.                     {
    24.                         Windows.UI.Xaml.Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor( Windows.UI.Core.CoreCursorType.Arrow, 0 );
    25.                     }, true );
    26. #endif
    27.                     break;
    28.             }
    29.         }
    30.  
    31.  

    Edit: I haven't run the code on a Win 10 Mobile phone ...
     
  16. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    Just a quick headsup: The version with Independant Input Source + our "hack" is live for a few days and we haven't received any reports so far.
    Also, the errors in the dashboard are disappearing, so I assume that did the trick.

    Thanks for pointing us into the right direction!


    Another side effect is, that using IIS, touch performance got better on low end devices like the Lumia 520 -- even though it is somewhere stated in the MS-docs, that IIS should only be used, if you have enough performance left over ... o0
    Weird, but OK :)
     
  17. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    XAML and input performance is weird. For some reason those controls hog the CPU when you touch screen on low end devices...
     
  18. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    Back on this never ending topic ...
    In the long run, the weekly user complaints are about the same.

    Today I discovered, that when using IIS and having the mouse locked, it can get messed up if you unlock the mouse, move the game window (windowed mode obviously ;) ), go back to the game, which sets it locked again: you don't received any mouse movement anymore.
    You can unlock the mouse >> mouse works.
    If you lock it again >> is doesnt work.

    When using input mode swap chain panel this is not an isse, so we're testing that again in live mode.

    Unity 5.6.0f3 (64-bit), Unity 5.6.1p1 (64-bit)