Search Unity

[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!