Skip to content

Small utility set of scripts for working with Unity and decoupling key bindings binding from calling code when working with Input.GetKeyX(KeyCode)

License

Notifications You must be signed in to change notification settings

NoxMortem/NoxKeys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Obsolete

NoxKeys predates the Unity3d InputSystem. I highly recommend to switch to it, as it has the same goal, and while it requires an even more verbose syntax and is more complex, it does scale much better (across number of keys, number of controllers, etc).

I will leave this repository public and available, for anyone of interest, but there won't be any further development.

NoxKeys

Simple utiltiy scripts helpful to decouple key bindings from handling code.

Features

  • Decouples KeyBinding from calling code
  • Provides interface for most common keys.
  • Provides pattern for both key strokes (Down,Up,Held) or modifiers (any)

Usage

  • Define custom Bindings in SmartKeys.Mapping.cs, and handle whatever special cases required.
// 1. Define Mapping in SmartKeys.Mapping.cs
public static bool Screenshot(Functor check) => check.All.Key(KeyCode.F12);
// 2. Provide accessor in SmartKeys.Functor
public bool Screenshot => Check(Mapping.Screenshot);
// 3. Optionally provide Modifier Behaviour
public static bool Screenshot => Check(Mapping.Screenshot);
  • Verify mappings via custom defined
if(SmartKeys.GetUp.Screenshot)
  • Verify single key strokes with SmartKeys.GetX.Key(KeyCode.Y)
if(SmartKeys.GetUp.Key(KeyCode.A))

Installation

  • Import the noxkeys-.unitypackage
  • Move the folder NoxKeys/* folder to a commonly used assembly
    • e.g. Plugins/* if you do not use assembly definitions

Disclaimer

This project is intented for personal use only at the moment and is provided AS IS. Use it at your own risk. If others find it helpful - great, if not fine.

About

Small utility set of scripts for working with Unity and decoupling key bindings binding from calling code when working with Input.GetKeyX(KeyCode)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages