Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

[New Input System] Enabling/Disabling actions working in Editor but not in build

Discussion in 'Input System' started by danigfe92, Apr 23, 2022.

  1. danigfe92

    danigfe92

    Joined:
    Sep 18, 2017
    Posts:
    1
    Hi everyone!

    I´m working with the new Input System for the first time and I´m having problems enabling/disabling input actions in build (Windows Standalone). However it is working fine in the Editor.

    What I´m doing to implement this functionality is something like this:

    Code (CSharp):
    1. public class Foo(){
    2.  
    3.  
    4.     public InputActionAsset actionMap;
    5.  
    6.  
    7.     private IEnumerator FooCoroutine()
    8.  
    9.     {
    10.  
    11.  
    12.         actionMap.Disable();
    13.  
    14.  
    15.         //Some other code
    16.  
    17.  
    18.         actionMap.Enable();
    19.  
    20.     }
    21.  
    22. }
    So basically, I have a reference to my InputActionAsset, and I just enable and disable all its actions ase suggested in the official docs.

    Has anyone faced this problem? And in case this is not the proper way of doing this, is there any alternative way of blocking user input using the new input system?

    Thanks!