First click, vector x,y are always 0

Hi, I’m making some test on new input system and I discoverd that when I try to get the first click of mouse or of a touch the Vector position is 0. However next clicks return a non 0 Vector.

Here it my configurations:

  • Windows 10
  • Unity 2021.3.01f
  • Input System 1.3
  • Game Run in Simulator Window

The controls asset (PlayerControls.inputactions) is configured as follows:

The code is the following:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class InputManager : MonoBehaviourSingletonPersistent<InputManager>
{
    PlayerControls playerControls;

    Vector2 initialPosition;

    private void OnEnable()
    {
        playerControls.Enable();

    }

    private void OnDisable()
    {
        playerControls.Disable();
    }

    public override void Awake()
    {
        base.Awake();
        playerControls = new PlayerControls();
    }

    // Start is called before the first frame update
    void Start()
    {
        playerControls.Player.Click.performed += _ => SetInitialPosition();
    }

    // Update is called once per frame
    void Update()
    {
        Vector2 pos = playerControls.Player.CameraMove.ReadValue<Vector2>();
    }

    void SetInitialPosition()
    {
        initialPosition = playerControls.Player.CameraMove.ReadValue<Vector2>();
        print(initialPosition);
    }
}

Thanks.

I’m having this issue too. Input System 1.3, Unity 2021.2.16f1

My internet search seems to indicate this was a bug in a previous version of Input System in 1.0 that was supposedly fixed about a year ago, but perhaps there was a regression?

Unfortunately, the bug is still present. I do not understand how there is no response from the Unity team. We are talking about a critical component for game development. And we are at version 1.3…

@amiga4K @lhicks Hey, I’m experiencing a bug that I think is similar, do you mind clarifying?

For some reason now, I am unable to drag sliders (or get mouse input in update) and have to click every time to update the position. Is what you are referring to?
This happens in builds too.

I just updated my project to 2021.3 from 2021.1.28 and now I’m seeing this very frustrating bug.

Thanks!