New Input system not working in unity2019.4.26 WebGL build but works when I upgrade to unity2021

Hi,

I am facing a weird issue.
I tried the new Input System version 1.0.1 and 1.1.1 with unity 2019.4.26 but both are not working in WebGL build, but works in unity editor.

When I upgrade the project file to unity version 2021 the WebGL build works fine.

I was trying to move a UI image in Canvas. Here is now the WebGL log looks like.

As you can see everything looks normal.

This is how I have set up my Input Action.

Here is the code

using UnityEngine;
public class ADAManager : MonoBehaviour
{
    public ADAInputAction adaInputMaster;
    [Header("References")]
    [SerializeField] private GameObject adaCursor;
    private Vector3 currentCursorPosition;
    private Vector2 adaCursorInput;
    private int screenWidth;
    private int screenHeight;
    private int cursorSensitivity = 2;
    private void OnEnable()
    {
        adaInputMaster = new ADAInputAction();
        adaInputMaster.Enable();
        screenWidth = Screen.width;
        screenHeight = Screen.height;
    }
    private void OnDisable()
    {
        adaInputMaster.Disable();
    }
    // Start is called before the first frame update
    void Start()
    {
        adaInputMaster.ada.move.performed += contex => OnMove(contex.ReadValue<Vector2>());
    }
    private void OnMove(Vector2 direction)
    {
        adaCursorInput = direction;
    }
    private void Update()
    {
        if (adaCursor.activeSelf)
        {
            currentCursorPosition = adaCursor.transform.position;
            float xValue = currentCursorPosition.x + (adaCursorInput.x * cursorSensitivity);
            float yValue = currentCursorPosition.y + (adaCursorInput.y * cursorSensitivity);
            if (xValue > screenWidth || xValue < 0)
                xValue = currentCursorPosition.x; // If at the limit of the screen, keep the value as-is
            if (yValue > screenHeight || yValue < 0)
                yValue = currentCursorPosition.y; // If at the limit of the screen, keep the value as-is
            adaCursor.transform.position = new Vector3(xValue, yValue, 0);
        }
    }
}

Please let me know if I should file a bug or am I doing something wrong.
@Schubkraft @Rene-Damm

Thanks

Does it work in 2019.4.30f1? Is you action of value type?
Otherwise please create a bug report so we can have a look

Hi,

I tried with unity 2019.4.30 as well but it’s not working.

I created a bug report - Case 1365069

Thanks

1 Like