ORK Framework uses a virtual control layer between Unity® and ORK.This control layer receives the player’s input (or can be set via script or HUDs) and is used across multiple parts of ORK.
Setting up an input key
Input keys can receive their input from various sources:
- None
Doesn’t receive any input, but you can still set it via HUDs or script. - Unity Input Manager
A key defined in the Unity® Input Manager is used. - Key Code
Set the positive and negative button using KeyCode. - ORK Input Key
The input comes from other ORK input keys. - Key Combo
A key combo sequence is used. - Mouse
A mouse button is used. - Touch
A touch is used. - Custom
A custom control script is used (e.g. a 3rd party input solution).
The axis of an input key can always be changed using HUDs and via script.
Input Origin: None
This input type doesn’t receive an input automatically.
It’s recommended to have at least one of this inputs – use it to disable key settings that you don’t want to use in your game.
Input Origin: Unity Input Manager
The input of a key defined in the Input Manager us used. See the Unity® documentation for details about the Input Manager.
Name
The name of the Unity® Input Manager key.
This must match the key’s name defined in the input manager.
Input Handling
Select when the input will be received:
- Down
When the key is first pressed down. - Hold
While the key is held down. - Up
When the key is released.
Input Origin: Key Code
Define a positive and negative button using KeyCode. See the Unity® documentation for a list of all available KeyCodes.
When using both positive and negative keys, a button press is trigger when any of the two defined keys receives input.
Positive Key
Select the KeyCode used for the positive button.
The positive button creates an axis value of 1.
Negative Key
Select the KeyCode used for the negative button.
The negative button creates an axis value of -1.
Input Handling
Select when the input will be received:
- Down
When the key is first pressed down. - Hold
While the key is held down. - Up
When the key is released.
Input Origin: ORK Input Key
You can combine multiple input keys to a single input. This way you can set up multiple inputs and still use them for the same thing, like combining left and right shift to a single input.
Simply enable all input keys you want to use.
The first input key of the list that received any input will also trigger this input key.
Input Origin: Key Combo
An input key can consist of a sequence of other input keys. The input key will only have a valid input and be used by ORK once the key combo sequence has been finished.
Each input key used in the sequence defines the time the player has to press the input key to not break the sequence.
Input Origin: Mouse
Mouse input can use the different mouse buttons as well as the number of clicks. E.g. you can set the input key to receive input when the right mouse button was clicked twice.
Mouse input can’t be used as an axis.
Input Origin: Touch
Touch input can use multiple fingers and tab counts. E.g. you can set the input key to receive input when 2 fingers tabbed 3 times on the screen.
Touch input can’t be used as an axis.
Input Origin: Custom
Custom input can be used to check a custom input solution (e.g. a 3rd party product) for input. This requries static functions to be available in your input solutions.
Class Name
This defines the name of the class that contains the static input functions that ORK will call.
This defines the name of the static function used for button input. The function must return a bool value, where true means received input.
You can optionally add parameters to the function call, e.g. the name of the checked input.
Custom Axis Function
This defines the name of the static function used for axis input. The function must return a float value, representing the axis input (usually between -1 and 1).
You can optionally add parameters to the function call, e.g. the name of the checked input.
Examples
This examples demonstrate how to use some simple inputs in ORK Framework.
If you want to use the Unity® Input Manager for your controls, simply create one input key for each input manager key and use the name of the key.
Vertical axis
This example demonstrates the settings of an input key used as a vertical axis (e.g. for navigating the menu or moving the player forward/backward).
The input key will use the keyboard’s arrow keys.
- Input Origin
Select Key Code. - Positive Key
Select Up Arrow. - Negative Key
Select Down Arrow. - Input Handling
Select Hold.
Accept key
This example demonstrates the settings of an input key used as the accept key (e.g. for accepting menu choices or starting interactions).
The input key will use the keyboard’s return key.
- Input Origin
Select Key Code. - Positive Key
Select Return. - Negative Key
Select None. - Input Handling
Select Down.
Code access
You can also access the input keys via script and check/change their state.
Accessing an input key is done using it’s index in the data list – the first key has the index 0.
Getting the state
ORK.InputKeys.Get(int index)
Returns the input key index.
ORK.InputKeys.Get(int index).GetButton()
Returns true if the input key index has been pressed.
ORK.InputKeys.Get(int index).GetAxis()
Returns a float value representing the axis of input key index.
Setting the state
ORK.InputKeys.Get(int index).SetAxis(float value)
Sets the axis of the input key index to value.
The axis is limited between -1 and 1.
Blocking the key
ORK.GetInputKey(int index).Blocked = true/false
Blocks (true) or unblocks (false) the input key index.
A blocked input key wont receive any input.