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. Dismiss Notice

Help needed with interactions

Discussion in 'Input System' started by transat, Jan 28, 2020.

  1. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    Looks like I can either:
    - create a jumpFly action with a tap and a hold interaction and have tap = jump and hold = fly
    - create 2 actions using the same button as input, the jump action would have a tap interaction and the fly action would have a hold interaction.

    Would both of these yield the same results? Or would the second option give me more control?
    With the second option, would the actions interfere with one another? ie If I hold down the button (to fly), will the character’s jump action accidentally register anything?

    cheers
     
  2. BinaryEclipse

    BinaryEclipse

    Joined:
    Sep 1, 2016
    Posts:
    43
    I think that in the callback, there must be a way to discern which interaction it came from, which would make it fine to have them on the same action, however I'm trying to find out how to do this.

    But for your specific case, you only need the hold interaction because on 'started', you can jump, and on 'processed', you can fly. Unless you have a double/multi jump system, which depends on your design/needs

    EDIT: sorry, I had the interactions part backwards. it's not multiple interactions on the same action that you would want there - what you would want is two different actions mapped to the same button. (but i still think that you only need the 'started' and 'performed' parts of a button hold)
     
    Last edited: Jan 28, 2020