Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

[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:
    124
    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:
    124
    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