Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Feedback path-token-getter methods for custom display strings ?

Discussion in 'Input System' started by uani, Jul 30, 2020.

  1. uani

    uani

    Joined:
    Sep 6, 2013
    Posts:
    232
    Do you offer path-token-getter methods for us to be able to create custom display strings from path (and possible modifiers) values?

    I could use a method which returns a hashmap HM of all token types each associated with an array of the values this token type has present inside a given path).

    Token Types would need to be documented in 1 place so that I know which to query for and the values would need to be abstracted and documented in 1 place as well, so that I could create a custom display string from mapping these value names to the names I like to use for them,

    For a HM returned for a path I could then create my output string (eg. "you pressed " +
    myCustomNameMapping(HM(tokenTypeInputOfMainInterest)[0])
    + " on " +
    myCustomNameMapping(HM(tokenTypeDevice)[0])
    ) (if tokenTypeX is present inside HM which I would need to check for first of course); in such output strings I could even select verbs like "pressed" and "on" based on the tokenTypes and Values in HM.

    I proposed an array of values because I guessed some simultaneously possible modifiers will be of a same token type even though the main value would likely be singular.

    Or does such a method already exist or is my desired outcome achievable already without doing my own regex?

    I found https://docs.unity3d.com/Packages/c...UnityEngine.InputSystem.InputControlPath.html and https://docs.unity3d.com/Packages/c...api/UnityEngine.InputSystem.InputControl.html but these I didn't completely read through and I didn't get a good understanding from what I have read.
     
    Last edited: Jul 30, 2020