Hello @gamingislove

What is the best practice to get and consume InputKeys from custom MonoBehaviour?

Doing something like

GamingIsLove.Makinom.Maki.InputKeys.Get(4).GetAxis(0);

where 4 is the "Horizontal Move" Input Key index, and 0 is the Input Setting ID of that Key, it works but looks cumbersome.
Post edited by RustedGames on
  • Since input keys are now their own assets, you can also simply reference them as an asset (InputKeyAsset).

    If you've got an asset, you can use these static functions to get button/axis input:
    bool button = InputKey.GetButton(asset);
    float axis = InputKey.GetAxis(asset);

    They also handle checking if the asset is null, so you can just fire them without worrying about that :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited July 2022
    Got it!

    var inputKeyAssetHorizontal = GamingIsLove.Makinom.Maki.InputKeys.GetAsset(4);
    float axis = GamingIsLove.Makinom.InputKey.GetAxis(inputKeyAssetHorizontal);
    Post edited by RustedGames on
Sign In or Register to comment.