Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to avoid receiving "Started" phase events.

Discussion in 'Input System' started by tarahugger, Feb 17, 2020.

  1. tarahugger

    tarahugger

    Joined:
    Jul 18, 2014
    Posts:
    129
    When subscribing to PlayerInput.onActionTriggered i am getting an event through for "started" and again for "Performed" phases. Is there a way to configure it on a per action basis, to filter it to only receive events for the phases i want?
     
  2. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,260
    When using the PlayerInput component no, not yet. @Rene-Damm had stated this somewhere that in the future possible after 1.0 they would add the different events. So you will have to filter it your self until then.
     
    tarahugger likes this.
  3. Jichaels

    Jichaels

    Joined:
    Dec 27, 2018
    Posts:
    237
    On your callback :

    Code (CSharp):
    1. private void OnYourAction(InputAction.CallbackContext ctx)
    2. {
    3.     if(!ctx.performed) return;
    4.  
    5.     // your logic      
    6. }