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

Resolved New Input System Flicker problem (if vector is not zero)

Discussion in 'Input System' started by yasinucar, Aug 10, 2023.

  1. yasinucar

    yasinucar

    Joined:
    Dec 18, 2018
    Posts:
    2
    Hello, I wrote a player movement using the new input system, I want the actions not to be performed when the key is not pressed in the update. But this causes a flicker, my character still moves after the key is pressed, what could be the reason for this?



    As you can see, even if I release the key, the character moves.
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,500
    Before the return set the velocity to vector3.zero.
    Right now the velocity is a positive value, so it will slow down by the amount of drag you set (like when you push a ball it will continue if you stop adding force). If you set the vel to 0 it will instantly stop
     
    yasinucar likes this.
  3. yasinucar

    yasinucar

    Joined:
    Dec 18, 2018
    Posts:
    2
    Thank you.
     
    DevDunk likes this.