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

Question Jump buffering with New Unity Input system

Discussion in '2D' started by Euphorus, Oct 19, 2023.

  1. Euphorus

    Euphorus

    Joined:
    Dec 20, 2022
    Posts:
    1
    Hello. I am currently working on my own 2D platformer game and recently my professor introduced me to the term "Coyote Time" and "Jump buffering". I researched about this topic a lot in the internet. Most of the tutorials are done with the old unity input system.
    I am confused how am I supposed to put Coyote Time with Unity's new input system.

    Thank you
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    37,112
    Absolutely NOTHING about coyote jumping or any of your game logic should care where the input comes from.

    Separating input concerns from game logic concerns:

    - make variables to represent possible player input intent

    Each frame:
    - gather input:
    --> clear those intents
    --> load input into those variables from input sources <---- this is the ONLY part that cares where the input comes from

    - process input from those variables: (note how NONE of this cares where the input came from)
    --> movement
    --> jumping (regular, coyote, whatever)
    --> shoot bullets?
    --> change weapons?
    --> other???

    All games should use this approach. Unfortunately far too many tutorials commingle the input and the processing, making it very hard to retrofit other input sources.

    Here is an example of the above:

    https://github.com/kurtdekker/proxi...emoCoyoteTimeJumping/DemoCoyoteTimeJumping.cs

    Look for functions called
    UpdateGatherInputs()
    and those beginning with
    Process*




    Full source at:

    proximity_buttons is presently hosted at these locations:

    https://bitbucket.org/kurtdekker/proximity_buttons

    https://github.com/kurtdekker/proximity_buttons

    https://gitlab.com/kurtdekker/proximity_buttons

    https://sourceforge.net/projects/proximity-buttons/
     
    Last edited: Oct 19, 2023