Search Unity

Unity stops processing input after the second time I press play - Unity 5.1.2f1

Discussion in 'UGUI & TextMesh Pro' started by Jaimi, Aug 14, 2015.

  1. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    This is strange - My gui works correctly the first time through. But after I stop and press play again - it displays, but I can no longer click on anything, and it doesn't even recognize a hover. I have to completely exit unity and restart to get it to work again. And then it only works the first time. Anyone seen this before?
     
  2. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Wow, this only appears to happen on my work box. Same version of Unity on both machines.
     
  3. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    295
    I had that problem, restarting the computer solved it. I think it came back though, but currently I'm on a period of time where the problem does not show up. Weird.
     
  4. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Yeah, I sent in a bug but all I've heard back on it so far is crickets. Restarting didn't work for me, still the same strange behavior. The system is detecting mouse clicks though, because the old Immediate Mode GUI still works just fine. Just the new GUI is dead after the first play through.
     
  5. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    This appears to be related to the size (or perhaps aspect ratio) of the game view. If I run with the game view maximized, then everything responds as normal. It's only when I do not run maximized (with the view around 1200x600 in the center of the editor) does this occur. Some issue with input processing on the Unity UI.
     
  6. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    295
    I started getting this again more frequently, so I had another look. (It's kinda annoying having to restart PC every time this happens.)

    The issue is that EventSystem does not seem to get an input module activated. It works for the first time, but after you change scene or exit playmode and run again, it does not work anymore. Select your EventSystem object in inspector and you can see there is no module activated. Workaround is to check "Force Module Active" and the EventSystem immediately picks it up. Yet it fails again when changing scene or running second time. :/

    EDIT: This is on 5.2.2f1, btw.
     
    Willemvd, Menion-Leah and krdevio like this.
  7. Nodrap

    Nodrap

    Joined:
    Nov 4, 2011
    Posts:
    83
    OMG I have just hit this same problem. Was working fine all morning. But now I can only run it once before my input just fails and I get "No module" on the EventSystem. OnGUI buttons work fine but the UI buttons fail. I restart Unity with no other changes and it works again - once. I am on the latest and patched 5.3.1p2.

    BTW I'd avoid 5.3.1 for a while, there seems to be some fairly basic bugs in it.
     
  8. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    295
    You can use my workaround above. To make things easier I made my game force the input module to be active after each scene change (in editor), no problems but still a bit silly to have to do that in the first place. :)
     
  9. Nodrap

    Nodrap

    Joined:
    Nov 4, 2011
    Posts:
    83
    No amount of screen size jiggling seemed to help. The reboot of my PC (Windows 7) seemed to fix it for me - for now. Will try your approach if it rears its ugly head again!

    I wonder if the bug is still marked open. If not it should be reopened as isn't fixed (@Jaimi).
     
  10. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    295
    It will, unfortunately. I'm running Windows 10 and have had the same problem since (at least) 5.1, restarting PC helps but it will come back. :(

    Too bad this is a very random problem that is difficult to reproduce. Seems it has something to do with EventSystem losing the input module.
     
    Ali_V_Quest likes this.
  11. krdevio

    krdevio

    Joined:
    Feb 26, 2015
    Posts:
    3
    Thanks mh114, that worked perfectly
     
    mh114 likes this.
  12. blookmaker

    blookmaker

    Joined:
    Jul 23, 2013
    Posts:
    1
    I have the exact same problem this morning and i was looking for a solution to fix this bug , thanks @mh114 for your fix, Unity Should fix this bug , it seems that all the UI system stops to work when this bug occur try adding a new gui text element in play mode for exemple and you will notice that the text is not displayed if you have the bug ...
     
    mh114 likes this.
  13. Brave-Michael

    Brave-Michael

    Joined:
    Jul 2, 2015
    Posts:
    5
    THANK YOU. You have no idea how long I've been suffering with this problem. And because it's very hard to describe in a google search, I've only managed to get to this thread now. Your fix of "Force Module Active" works great.
     
    mh114 likes this.
  14. tjunqueira

    tjunqueira

    Joined:
    Aug 24, 2015
    Posts:
    2
    I had the same problem when I tried to run using the version 32-bits. It doesn't happen with the unity 64-bits.
     
  15. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    295
    I've had this problem since 5.x (maybe 5.1, or 5.2), always used 64-bit versions.
     
  16. Wolfnux

    Wolfnux

    Joined:
    Feb 13, 2013
    Posts:
    1
    I've got the same problem recently.
    I confirm: Sometimes restarting Unity seems to works. Sometimes the system.
    To force the module too. But is there any impact on anything to force it ?
     
  17. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    295
    Nope, and the bug is in editor only from what I've seen. I made my game force the input module on each scene change in the editor, so this doesn't bother me anymore. That's not to say I wouldn't want it to be fixed.
     
  18. Ali_V_Quest

    Ali_V_Quest

    Joined:
    Aug 2, 2015
    Posts:
    138
    Thanks very much.
     
    mh114 likes this.
  19. Willemvd

    Willemvd

    Joined:
    Mar 19, 2014
    Posts:
    8
    Super - this fixes it for me too - but annoying to have to do constantly. Thanks man

    @Unity - icanhazfix?
     
    mh114 likes this.
  20. SuperWang

    SuperWang

    Joined:
    Jul 12, 2016
    Posts:
    1
    So sad ~~ Unity not fix until Unity 5.3.4p6
     
  21. Dimetrock

    Dimetrock

    Joined:
    Dec 9, 2012
    Posts:
    37
    Not fixed in Unity 5.6
     
  22. creativedist

    creativedist

    Joined:
    Apr 24, 2018
    Posts:
    1
    My problem is solved by just fill up some standalone input module properties just like Horizontal Axis , Vertical Axis and so on because it takes garbage value. You just remove the garbage value and put accurate values.These values are available on input setting.
     
  23. evans_unity187

    evans_unity187

    Joined:
    Sep 19, 2017
    Posts:
    5
    We experienced the same when we had two Event Systems in the scene. Try delete one
     
  24. Krupaankith

    Krupaankith

    Joined:
    Aug 30, 2021
    Posts:
    4
    I'm still facing the problem even though I followed your workaround. using 2020.3.19f1.
     
  25. Krupaankith

    Krupaankith

    Joined:
    Aug 30, 2021
    Posts:
    4
    Ah it was just that my mouseLock was active, You can cancel that by going into your playermovement script and deleting the lockMouseButton command.
     
  26. paulbetteridge

    paulbetteridge

    Joined:
    Dec 21, 2021
    Posts:
    4
    Me too. I have tried all the above and it just does not work. It is driving me crazy. I am on 2020.3.26f
     
  27. paulbetteridge

    paulbetteridge

    Joined:
    Dec 21, 2021
    Posts:
    4
    *RESOLVED* It was my timescale set to 0 on my game over UI canvas. Set to 1 and now it is ok


    public void GameOver()
    {
    gameOverCanvas.SetActive(true);
    Time.timeScale = 1f; //was 0
     
  28. wwwneketwww

    wwwneketwww

    Joined:
    Aug 19, 2022
    Posts:
    2
    01.10.2022
    I have same problem, but to check "Force Module Active" doesn't help me!
    :(:(:(
    Unity 2021.3.8f1 Personal DX 11
    And I'm looking for any ideas how to fix that:(
     
  29. wwwneketwww

    wwwneketwww

    Joined:
    Aug 19, 2022
    Posts:
    2
    I was fix it (in my case I need to hide UI elements) by change my C# script from

    gameObject.SetActive(true);

    to

    CanvasGroup cg = GetComponent<CanvasGroup>();
    cg.interactable = false;
    cg.alpha = 0;

    For that u need to attach CanvasGroup for your UI gameobject;
    I hope my case help somebody work around this bug

    o_O