Hello. I’m having issues with the on-screen controls with the new input system. I’ve had it working perfectly before so I’m not sure what broke. I’ve also followed tutorials that produced the same results. Basically, I subscribe to the action, and then call one of the buttons like “gamepad left stick” with the on-screen stick controls. It only seems to work if I enable the “auto-switch” button in the player input class. However, the controls are extremely jerky, get stuck, and don’t move properly. If I turn off “auto-switch”, things move smoothly but don’t call the actions anymore.
Here is some test code I setup. I also provided a link to a picture of the main settings I’m using.
public class TestInput : MonoBehaviour
{
public PlayerInput playerInput;
void OnEnable()
{
if (playerInput.enabled)
{
Debug.Log("player input is enabled");
}
playerInput.actions["Fire"].performed += Shoot_performed;
playerInput.actions["Move"].performed += TestInput_performed;
playerInput.actions["Move"].canceled += TestInput_performed;
//controls.Player.Fire.performed += Shoot_performed;
}
private void TestInput_performed(InputAction.CallbackContext obj)
{
Debug.Log("Move");
}
private void Shoot_performed(UnityEngine.InputSystem.InputAction.CallbackContext obj)
{
Debug.Log("shoot");
}
private void Update()
{
if (playerInput.actions["Move"].WasPressedThisFrame())
{
Debug.Log("move poll check");
}
}
}
Any help would be greatly appreciated. Thanks!
