Hi, I’m trying to get PlayerInput to work with multiple control schemes (one for mouse/keyboard and one for Gamepad) and it doesn’t seem to work. I’m using the script below:
using UnityEngine;
using UnityEngine.InputSystem;
public class InputTest : MonoBehaviour
{
private void Start()
{
PlayerInput input = GetComponent<PlayerInput>();
input.actions["DoThing"].performed += DoThing_performed;
}
private void DoThing_performed(InputAction.CallbackContext obj)
{
Debug.Log("CLICK!");
transform.position += Vector3.up;
}
}
When I have a single control scheme with DoThing mapped to the left mouse button, this works fine. When I create two control schemes (one called MKB and one called Gamepad) it does not work. The input debugger shows that the MKB scheme is selected for the player, but the events are not firing. Not sure if I’m doing something wrong. Tested in both 2019.1 and 2019.2, empty projects.
If you are using 1.0.0 Preview it is broken you have to have preview-1 It was like that for everyone before they released the new package update last week.
Was able to get it working—I did not have any required devices on my control schemes, which I guess makes PlayerInput unable to correctly assign a control scheme.
I was able to get it working on 0.9.5, so it either may have been a regression in 1.0.0, or you could be encountering a different issue.
Oh no it was a bug that was introduced in 1.0.0 Preview that was fixed in 1.0.0 Preview 1. Glad you got it working though. Things like that should be labeled in the documentation so people who haven’t used the Input System will know that.
Just to confirm, yes, if there’s control schemes in the actions, PlayerInput entirely goes by their device requirements. I’ve made a note that we should probably log a warning if there’s no requirements present on the schemes.