Search Unity

[Interaction] Adding interaction on an action during runtime

Discussion in 'Input System' started by dzamani, Mar 26, 2019.

  1. dzamani

    dzamani

    Joined:
    Feb 25, 2014
    Posts:
    122
    Hi!

    It seems like I'm not able to find how to add HoldInteraction, for example, on an action. Let's say I have the *.inputactions file and I want to add some interactions on some actions of an instance of this file, how should I do it ?

    I know I can add them from the file or by using an InputAction field on a MonoBehaviour but that's not what I want since it would depend on runtime / user factors.

    Thanks!
     
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    I think the API here still has holes. The API that is meant to cover this is in InputSetupExtensions. However, ATM there's nothing that allows you to take an existing binding and just change it however you want at runtime -- which is certainly intended to be allowed. I'll have a look at adding API for this.
     
    recursive and dzamani like this.
  3. dzamani

    dzamani

    Joined:
    Feb 25, 2014
    Posts:
    122
    Thanks!

    For now I'm setting these input to continuous and handling the interactions myself but it would be great to have this feature, thanks!
     
  4. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779