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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Unity Input System Stopped Calling Events

Discussion in 'Input System' started by DaLivelyGhost_n_Stuff, Nov 20, 2020.

  1. DaLivelyGhost_n_Stuff

    DaLivelyGhost_n_Stuff

    Joined:
    Nov 19, 2014
    Posts:
    2
    I had a working set of controls set up last night, I was able to log events from my button presses and 2d axis. This morning, I changed my 2d axis to 2 1d axis, and now I not only have an error for "Cannot find action" on my action that no longer exists, but no events work anymore. I've restarted my Pc, I've deleted the C# file generated by the action map and remade it, I've rebuilt the controls, and nothing's working. I'm not sure how to get around this. I'm using Unity's Input System 1.0.0

    This is my action Map. Pitch and Yaw used to be a 2D axis named "Steering"
    help01.png
    The error:
    help02.png

    This is an abridged version of my code that handles my user input

    Code (CSharp):
    1. public class WASDMovement : MonoBehaviour
    2. {  
    3.     public Controls _inputActions;
    4.     [HideInInspector] public Rigidbody _rb;
    5.  
    6.     private void Awake()
    7.     {
    8.         _inputActions = new Controls();
    9.  
    10.         _inputActions.Player.Pitch.performed += OnPitch;
    11.         _inputActions.Player.Yaw.performed += OnYaw;
    12.  
    13.         _inputActions.Player.Toggle_Accelerate.performed += OnToggle_Accelerate;
    14.         _inputActions.Player.Brake.performed += OnBrake;
    15.     }
    16.  
    17.     private void OnEnable() {
    18.  
    19.         _inputActions.Enable();
    20.     }
    21.     private void OnDisable() {
    22.         _inputActions.Player.Pitch.Disable();
    23.         _inputActions.Player.Yaw.Disable();
    24.  
    25.         _inputActions.Player.Toggle_Accelerate.Disable();
    26.         _inputActions.Player.Brake.Disable();
    27.        
    28.         _inputActions.Disable();
    29.     }
    30.     private void Start()
    31.     {
    32.         _rb = GetComponent<Rigidbody>();
    33.  
    34.     }
    35.     public void OnPitch(InputAction.CallbackContext obj)
    36.     {
    37.         Debug.Log("Pitch");
    38.     }
    39.     public void OnYaw(InputAction.CallbackContext obj)
    40.     {
    41.         Debug.Log("Yaw");
    42.     }
    43.     public void OnToggle_Accelerate(InputAction.CallbackContext obj)
    44.     {
    45.         Debug.Log("Accelerate");
    46.     }
    47.     private void OnBrake(InputAction.CallbackContext obj)
    48.     {
    49.         Debug.Log("Brake");
    50.     }
    51. }
     
  2. DaLivelyGhost_n_Stuff

    DaLivelyGhost_n_Stuff

    Joined:
    Nov 19, 2014
    Posts:
    2
    Update: Now the Yaw event is working, but none of the others.