Search Unity

Question How do i differentiate when the input is held and not held? [New input system]

Discussion in 'Input System' started by Ikelos101, Oct 30, 2023.

  1. Ikelos101

    Ikelos101

    Joined:
    Apr 16, 2023
    Posts:
    2
    I'm coding a dynamic weapon system where I can basically create any weapon with scriptable objects easily by reusing a lot of code and just changing a few values.

    I simply have to differentiate between when the fire input is held and not held, I investigated, and I thought I could do it by just adding a hold modifier on top of the already existing press modifier and checking it in code would be enough but the code inside the if statement simply gets called once same with just the press one. This is my code and my input setup currently:

    (the boolean parameter in the attack method just indicates whether the input is held or not, so that the weapon will fire full auto or semi auto)

    upload_2023-10-30_16-6-12.png upload_2023-10-30_16-8-38.png upload_2023-10-30_16-8-51.png
     

    Attached Files: