Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Feature Request Feature Request: Input Action Map Asset

Discussion in 'Input System' started by X3doll, Oct 26, 2022.

  1. X3doll

    X3doll

    Joined:
    Apr 15, 2020
    Posts:
    37
    Hi,

    As the input system enable you to make your actions, like:

    upload_2022-10-26_10-30-41.png

    Why there is not method to retrieve the map as serialized reference? I know that the map actually is a class. Why is not a sub-scriptable object either like the actions, containing the action itself?

    My use case is something like this:

    Code (CSharp):
    1. public class Map : Monobehaviour
    2. {
    3.      [SerializeField]
    4.      // This class did not exists, is not possible to reference map actions in inspector !!!
    5.      private InputActionMapReference mapActions;
    6.  
    7.      [SerializeField]
    8.      // This actions are sub-action of the map
    9.      private InputActionReference interaction;
    10.  
    11.      [SerializeField]
    12.      // This actions are sub-action of the map
    13.      private InputActionReference navigation;
    14.  
    15.      public void OnEnable()
    16.      {
    17.             mapActions.Enable();
    18.      }
    19.  
    20.      public void OnDisable()
    21.      {
    22.             mapActions.Disable();
    23.      }
    24. }
    This because i have to split logically the input for each game actor. But without action map reference i have to do dirty reference with string name, which is broke the game if you change some input globally from the action map.

    Code (CSharp):
    1. public class InputActionMapReference : ScriptableObject
    2. {
    3.      [SerializeField]
    4.      private InputActionAsset mapActionAsset;
    5.  
    6.      [SerializeField]
    7.      private string mapName;
    8.      
    9.      public InputActionMap GetActionMap()
    10.      {
    11.           return mapActionAsset.FindActionMap(mapName);
    12.      }
    13. }
    Which is the only (and odd) solution to mantain action maps that are easy to maintain through the entire project lifetime.

    What is the purpose of enabling and disabling map if i cant referencing it? A this moment, it feels more maintainable to put all the game input in one map and enabling / disabling when we want. The action map big purpose and feature seems killed by my side (Maintain all the actions inside).