πΉοΈ Input
Create custom Bindings and Retrieve Input information
info
π§ Authority: This can be accessed only on Client.
πΏ Static Class: This is a Static Class. You can access itβs methods directly with .
. It is not possible to initialize or create new instances.
caution
This Class is experimental, so you can try it out and provide feedback before it's full release!
Usageβ
-- Registers the binding_name 'SpawnMenu' with default key 'Q'
-- This will add 'SpawnMenu' to user KeyBinding Settings automatically
Input.Register("SpawnMenu", "Q")
-- Subscribes for Pressing the key
Input.Bind("SpawnMenu", InputEvent.Pressed, function()
-- Opens the Spawn Menu
end)
-- Subscribes for Releasing the key
Input.Bind("SpawnMenu", InputEvent.Released, function()
-- Closes the Spawn Menu
end)
Static Functionsβ
Returns | Name | Description |
---|---|---|
Bind | Binds a function to an Input defined using Register or from Game | |
Unbind | Unbinds a Input function | |
Register | Registers a BindingName to a Key | |
Unregister | Unregisters a BindingName | |
string | GetKeyIcon | Gets the icon Path of a Key |
string | GetMappedKey | Returns the Key given a BindingName |
ResetBindings | Resets all Bound functions by this Package | |
table | GetGameKeyBindings | Returns a table with all Game KeyBindings |
table | GetScriptingKeyBindings | Returns a table with all Scripting KeyBindings |
Bind
β
Binds a function to an Input defined using
Register
or from Game
Input.Bind(binding_name, input_event, callback)
Type | Parameter | Description |
---|---|---|
string | binding_name | The KeyBinding ID |
InputEvent | input_event | Which Event to register (Released/Pressed) |
function | callback | The function to trigger |
Unbind
β
Unbinds all Input functions related to that binding_name and input_event
Input.Unbind(binding_name, input_event)
Type | Parameter | Description |
---|---|---|
string | binding_name | The KeyBinding ID |
InputEvent | input_event | Which Event to register (Released/Pressed) |
Register
β
Registers a BindingName to a default Key
Input.Register(binding_name, key_name)
Type | Parameter | Description |
---|---|---|
string | binding_name | The KeyBinding ID |
string | key_name |
Unregister
β
Unregisters a BindingName
Input.Unregister(binding_name, key_name)
Type | Parameter | Description |
---|---|---|
string | binding_name | The KeyBinding ID |
string | key_name |
GetKeyIcon
β
Gets the Icon image path from a Key
Returns string
Input.GetKeyIcon(key_name, dark_mode)
Type | Parameter | Default | Description |
---|---|---|---|
string | key_name | ||
boolean | dark_mode | false |
GetMappedKey
β
Gets the Key given a BindingName
Returns string
Input.GetMappedKey(binding_name)
Type | Parameter | Description |
---|---|---|
string | binding_name | The KeyBinding ID |
ResetBindings
β
Resets all Bound functions from this Package
Input.ResetBindings()
GetScriptingKeyBindings
β
Returns a table with all Scripting KeyBindings
Returns a table
Input.GetScriptingKeyBindings()
GetGameKeyBindings
β
Returns a table with all Game KeyBindings
Returns a table
Input.GetGameKeyBindings()