Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

PlayerInput scheme jitter

Discussion in 'Input System' started by Titan8190, Jun 19, 2021.

  1. Titan8190

    Titan8190

    Joined:
    Feb 16, 2013
    Posts:
    29
    edit: title changed from "OnScreenStick firing cancel events", now that I found the actual issue.

    When using OnScreenStick, the associated callback is called 3 times with started, performed and cancelled set to true in a random order whenever I move the stick.

    - I added logs to OnScreenStick, OnPointerUp and OnDrag are called as expected, it is OnDrag that causes Cancelled events.
    - Then I tried to use ReadValue instead of relying on events to bypass this issue but the returned value is also randomly a zero vector depending on the last fired event.
    - I updated to 1.1.0-pre.5 in case it was fixed but it didn't changes anything.

    I could not find any similar issue, yet I have the most basic setup possible. Does anyone know what I could be doing wrong ?
    I have a "Left Stick [Gamepad]" defined in my InputAction, it matches my OnScreenStick's "Control Path", then I have a PlayerInput sending events to a Player.cs class that moves the character.
     
    Last edited: Jun 21, 2021
  2. Titan8190

    Titan8190

    Joined:
    Feb 16, 2013
    Posts:
    29
    The issue came from my controls schemes. I deleted every control scheme and it surprisingly works fine without them.

    I noticed that the selected scheme jitter in the debug inspector of my PlayerInput between "keyboard" and "Gamepad" when I move my stick.
    I tried to remove "autoswitch" and set it to my gamepad scheme for a test, but then my virtual gamepad didn't do anything at all. When I do that the "Devices" debug field in inspector is empty, but if I leave the scheme to all, then as it jitter it is display "Gamepad:/Gamepad".

    I had a "mouse&keyboard" scheme with "mouse" and "keyboard" devices selected, I also had "gamepad" scheme with the generic "gamepad" selected. I don't understand the required/optional picker, tried both without difference.

    just removing the schemes is good enough for my next project, this seems to exist only for local multiplayer, I would still need someone to explains me what's going on here.
     
    Last edited: Jun 21, 2021
  3. Bricat

    Bricat

    Joined:
    Nov 10, 2015
    Posts:
    3
    Hey! I just want to say thank you for posting your experience here! I have been experiencing this weird issue where controlling both analogue sticks together on a gamepad make movement jittered... (which didn't happen in keyboard and mouse control) and I found your post and deleted all the control schemes. and now there is no jitter at all! all smooth and working as exected! :D I really don't know why this is hapening. Unity need to fix this issue imidieatly as it is almost 2 years later since you posted this... Anyway, thanks to Titan216 !