Input System doesn't trigger anything anymore

Hello !

TL;DR : InputSystem worked some days ago, don’t trigger anything anymore, halp.

I tried the new Input System some days ago, and that’s really neat ! I did a lot of stuff, trying to understand the best way to use it, and, in the end, I had a character jumping and moving everywhere, that was cool ! Then, I merged my code in our develop branch and went to bed.

Today, I want to continue my code, but my character doesn’t move anymore, Actions are not triggered (even if inputs are detected in debugger) and I really don’t know why. Either the code merge overwrote some important settings (I know what you’re thinking and yes, the “Active Input Handling” is set on “Both” and I tried only running the preview) or I did something important during my little tests and I didn’t realize.

So I decided to try to reproduce my steps on a fresh new project, maybe you guys can help me figure what do I do wrong ?

1/ Create a new 2D project (via the Hub)

2/ Install the latest Package (version 0.9.0)

3/ Click Yes on that message prompt to activate the new Input management in the settings
4791665--457760--upload_2019-7-27_13-50-34.png

4/ Restart Unity Editor since it didn’t restart even if the message said it would and check the project settings (yes, it’s on “Both”, and yes, my Scripting Runtime Version is 4.0)

5/ Create a new GameObject and add a PlayerInput on it

6/ Click on “Open Input Settings” and create an “InputSettings” asset

7/ Click on “Create Actions…” to create my ActionMap asset

8/ Create a “TestAction” on my “Player” ActionMap and set it to the key “t”

9/ Create a new Script “TestScript” that contains a OnTestAction() method (that only logs “test”) and enables the test map/action (just to be sure) :

using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.PlayerInput;

public class TestScript : MonoBehaviour
{
    void Start()
    {
        InputActionMap playerActionMap = GetComponent<PlayerInput>().actions.GetActionMap("Player");
        playerActionMap.Enable();
        playerActionMap.GetAction("TestAction").Enable(); //Just to be sure
    }

    public void OnTestAction()
    {
        Debug.Log("test");
    }
}

10/ Pressing “Play” and spamming “T” like a madman to try to display a debug (note that, in the debugger, a User is created, my “t” presses are detected, my TestAction exists and is mapped on the “t” key but no debug is displayed

It’s probably a silly problem, but it’s driving me crazy, what do I do wrong ? It’s even more infuriating that it worked some days ago !

Additional information :

  • Switching the Input Management from “Both” to "New Input System (preview) does nothing
  • Checking in Update() is my action is enabled returns “True” every frame
  • Checking in Update() is my action is triggered returns “False” every frame
  • Using action.started/triggered/performed does nothing (I tried also switching to UnityEvent or C# events for this) :
public class TestScript : MonoBehaviour
{
    InputAction a;

    void Start()
    {
        InputActionMap playerActionMap = GetComponent<PlayerInput>().actions.GetActionMap("Player");
        playerActionMap.Enable();
        a = playerActionMap.GetAction("TestAction");
        a.Enable(); //Just to be sure
        a.started += OnTriggeredTestAction;
        a.performed += OnTriggeredTestAction;
        a.canceled += OnTriggeredTestAction;
    }

    public void OnTestAction()
    {
        Debug.Log("test");
    }

    public void OnTriggeredTestAction(InputAction.CallbackContext ctx)
    {
        Debug.Log("test triggered");
    }
}
  • Injecting directly the InputActionReference of my TestAction and using it does nothing
  • Forcing “Default Control Scheme” and “Default Action Map” does nothing
  • Using BroadcastMessage or UnityEvents doesn’t work

4791665--457766--upload_2019-7-27_13-55-21.png

2 Likes

This happens to me too .-.

Looking at your input debugger, when was the last time you rebooted your computer?
Myself and some of my testers had the same issue and that fixed it. See ([0.9.0] Input debugger shows event time of -4293049s · Issue #737 · Unity-Technologies/InputSystem · GitHub)

2 Likes

Thank you a lot Stephano, that was it ! It was driving me crazy, but after a reboot, everything was working again ! You saved me a great amount of time !

I posted my issue on StackOverflow some days ago : c# - The new Input System doesn't trigger anything anymore - Stack Overflow. If you want some well-deserved StackOverflow points, you can post your answer here, I’ll accept it =).

I’m having the same problem. And sadly, reboot doesn’t helps anything.
The funny thing is that when i first imported input package, the samples were working perfectly. But when i started to make my controls, generated c# class and implement interfaces, then it stopped working.
Switching back to old input system, again… ;(

@MetalFox (and others) - As a side note, If you do not have a Default Action Map defined in the PlayerInput component, nothing will get routed. It looks like this may have also been a factor, based on your screenshot.

1 Like

My gosh… This new input system is SOO disgustingly unstable.

  1. It doesn’t work when i adding any control scheme
  2. Then Player Input works only with SendMessages or BroadcastMessages behavior
  3. They are dropping fps to zero (with SendMessages), or gives frequent one frame lags with BroadcastMessages. (maybe it’s because of debug logs)
  4. Interfaces implementation (from generated C# class) doesn’t work as well

How in the earth i should work with this?

7 Likes

Just to make sure I follow. With the current setup you have, if you choose SendMessages or BroadcastMessages, input is indeed coming through as you expect. I.e. all methods are getting called in accordance to input.

But then, if you switch to UnityEvents and select methods to call for each event, the respective method is NOT getting called?

It is. Many events are high-frequency. Debug.Logs are very expensive (because of the cost of extracting stack traces and in the editor, also due to the cost incurred by the console view which does some expensive searches internally).

The C# code-generation workflow and PlayerInput are currently not combinable. We’ll be looking for ways to use the two together after 1.0.

1 Like

Player Input doesn’t work at all when i have any “Control Scheme”
When i don’t have it … It doesn’t work as well:5101619--503105--upload_2019-10-24_16-35-3.png
(UnityEvents)
5101619--503108--upload_2019-10-24_16-35-35.png
(SendMessages / Broadcast)
Invoke C Sharp Events doesn’t call anything at all.


I’ve got Input System to work, but without Player Input or C# generated class.
I’m just directly adding callback methods like this:
5101619--503072--upload_2019-10-24_15-52-20.png

5101619--503078--upload_2019-10-24_15-54-4.png

I think it should be built-in methods. It’s so easy to work with, and it doesn’t require C# generated class.

And, by the way, after i’ve finally got it to work, New System have impressed me - it’s 1000x times better than old system! Cudos! :slight_smile:
But i hope it will be more user friendly (especially for not programming people) and Player Input will be fixed

1 Like

Everything will also stop working if you delete an old InputActions asset + generated code and try to start with a new one in a project. Even after rebuilding library, which is a bummer.

Any fix for this? The input system is unusable for me because of this. It was working fine before I deleted an old InputActions asset.

I thought I’d try this package because it seemed interesting. Unfortunately, issues like this are just mindboggling. You can build a whole fancy system but when inputs get completely ignored, what’s the point? Should I ask my players to make sure to reboot their PC before playing my game? No one will and no one should use this package because it doesn’t work. Endlessly frustrating and embarrassing.

2 Likes

Hi, could you share that full class? I’m having the same problem too and your solution seems nice and simple. Thanks!

I updated a project I hadn’t touched for a while to the latest 2020.2.0b8 beta. Everything worked, with the exception of all keyboard / mouse input. After spending some time fiddling with the PlayerInput component and inspecting my scripts, I noticed that the value of the Active Input Handling setting had reverted back to Input Manager (old) in Project Settings.

In this case you’d think that the most simple solution to input not registering would be setting this value back to Input System Package (new) or Both… It would, however, seem that the value can’t currently be changed due to some bug or another. Trying to do that just leaves the setting unmodified and writes this error to the console:

Cancelling Display Dialog : This should not be called when a View's DrawRect Method is in progress

All other project settings seem to be correct. Only this one detail has been affected by something, likely the process of updating the project for a newer Unity editor version?

Input System package version is 1.0. I think it was the same before I updated the project.

EDIT: Apparently the bug with the value of Active Input Handling resetting is a known issue in 2020.2 beta, and will be fixed. Just in case somebody ran into the same problem.

1 Like

I have the exact same issue, I even tried thought code using “enableNativePlatformBackendsForNewInputSystem” but the key is not found…

This works:

var property = GetPropertyOrNull("activeInputHandler");
var value = 2; //(0: old, 1: new, 2:both)
if (property != null)
{
    property.intValue = value;
    property.serializedObject.ApplyModifiedProperties();
}

Thanks for the tip, looks like a working workaround. However it would seem that the issue has been fixed in the latest beta version 2020.2.0b14 that I just updated my project to. InputSystem package version is 1.1.0-preview2.

my character was able to enter a car and drive it since i build the game it doesnt work anymore. i can run and do everything in the first action map but in the second action map nothing work. in the editor it doesnt work too

Such an obtuse system

8 Likes

Please avoid making multiple posts with little to not context. We definitely value feedback, but please try to do this constructively with the one post.

1 Like

I switched my input system to the new one yesterday and everything was working fine, however today immediately after loading the project, my player wasn’t even moving.

After some investigating I realized the problem was that I was calling an action .performed on Awake on one script, while referencing the Input Asset on another script’s Awake method. After moving the call to Start ( ) it seems to be working again.

I am not sure how this was working yesterday though, would appreciate if someone could shine a light on this.