Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity freezes because of input system Disable() function

Discussion in 'Input System' started by FeastSC2, Oct 20, 2019.

  1. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    978
    I created an action map called Player, it has an action called Interact.

    In one of the implementations of my interact action, I disable the Player action map to enter a menu and disable the input of player.
    That's where Unity freezes and I must kill Unity's task with Task Manager.
     
  2. Hookkshot

    Hookkshot

    Joined:
    Jan 11, 2013
    Posts:
    27
    I get the same thing using InputPlayer PassivateInput();
     
  3. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Sounds like a setup that may be ping-ponging between enabling and disabling of two maps. Still, even if, the system should have safeguards to detect that and prevent a deadlock.

    @FeastSC2 Could you file a ticket with the Unity bug reporter? We'll have a look.
     
  4. gallobonts

    gallobonts

    Joined:
    Jan 1, 2013
    Posts:
    1
    Did you ever get around this issue? Or did you just use other means to pause your input?
    Still seems to be an issue on both 2019.4.0f1 & 2020.1.13f

    Edit: It seems to only occur when the input was what triggered the disable.

    For example I have an event that triggers the disable that works no problem. But a pause button seems to cause problems. Perhaps I can get around it by putting the pause action on it's own action map. I'll have to look into that possibility later.
     
    Last edited: Nov 18, 2020
  5. Andruxin52rus

    Andruxin52rus

    Joined:
    Jul 5, 2020
    Posts:
    3
    IDK if it's gonna help anyone, but that's what worked for me:
    Code (CSharp):
    1.     public void OnSelect(InputAction.CallbackContext context)
    2.     {
    3.         if (context.performed) // THE TRICK
    4.         {
    5.             controls.Selection1.Disable();
    6.             controls.Selection2.Enable();
    7.         }
    8.     }
    Here I'm passing input control from Selection1 to Selection2 Action Maps. You have to make sure it's done only during "performed" phase (hence, once per OnSelect call). Otherwise, Disable/Enable will be called several times, and seems like it creates problems