Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Enabling input action works even if input is disabled on the new input system?

Discussion in 'Scripting' started by TheRealRan, Mar 13, 2021.

  1. TheRealRan

    TheRealRan

    Joined:
    Jun 3, 2019
    Posts:
    18
    Lets say I have the following code:

    Code (CSharp):
    1. public void Disable()
    2. {
    3.   input.Disable();
    4. }
    5.  
    6. public void EnableAction()
    7. {
    8.   input.MyMap.MyAction.Enable();
    9. }
    If I disable my input thought the 'Disable()' function but right after call the 'EnableAction()' function, it will work, even though the input itself is disabled.

    I've also tried to disable 'input.MyMap.Disable()'.

    'input' is a auto-property.

    Is this intended? Is it a bug? Or is it just me doing something wrong?
     
    Last edited: Mar 13, 2021
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,722
    TheRealRan likes this.
  3. TheRealRan

    TheRealRan

    Joined:
    Jun 3, 2019
    Posts:
    18
    Oh, so the Enable and Disable for the input is actually to enable and disable all actions, not to enable or disable the actual input system.

    Is there a way to disable everything and not allow it to be enabled, the way I intended, without extra code and variables on my own?