InputService¶
Inherits Instance
InputService is a class used for retrieving user input data, such as the mouse and keyboard.
Static Class
This object is a static class. It can be accessed by using its name as a keyword.
Additionally, it cannot be created in the creator menu or with Instance.New().
Not newable
This object cannot be created by scripts using Instance.New().
Properties¶
IsWindowFocused : boolean¶
Indicates whether the game window is currently focused.
IsTouchscreen : boolean¶
Indicates whether the input device is a touchscreen.
IsGameFocused : boolean¶
Indicates whether the game is currently focused.
IsInputFocused : boolean¶
Indicates whether an input is currently focused.
IsGamepadConnected : boolean¶
Indicates whether a gamepad is currently connected.
IsMenuOpened : boolean¶
Indicates whether the game menu is currently opened.
CursorLocked : boolean¶
Determines whether the cursor is currently locked.
CursorVisible : boolean¶
Determines whether the cursor is currently visible.
MousePosition : Vector2¶
Indicates the current position of the mouse cursor.
ScreenWidth : number¶
Indicates the width of the screen.
ScreenHeight : number¶
Indicates the height of the screen.
Methods¶
GetMouseWorldPosition → Vector3¶
Parameters: ignoreList [ table? ]
Returns the 3D world-space position corresponding to the current mouse cursor location.
GetVector2 → InputActionVector2¶
Parameters: actionName [ string ]
Returns the current Vector2 value of the action.
GetButton → InputActionButton¶
Parameters: actionName [ string ]
Returns true if the specified button is being held down.
GetAxis → InputActionAxis¶
Parameters: actionName [ string ]
Returns the value of the specified axis.
BindButton → InputActionButton¶
Parameters: name [ string ]
Bind new Button Input Action
BindAxis → InputActionAxis¶
Parameters: name [ string ]
Bind new Axis Input Action
BindVector2 → InputActionVector2¶
Parameters: name [ string ]
Bind new Vector2 Input Action
Events¶
GameFocused¶
Parameters: ``
Fires when the game has been focused
GameUnfocused¶
Parameters: ``
Fires when the game has been unfocused
GamepadConnected¶
Parameters: ``
Fires when gamepad is connected
GamepadDisconnected¶
Parameters: ``
Fires when gamepad has been disconnected
KeyDown¶
Parameters: keycode [ KeyCode ]
Fires when key has been pressed
KeyUp¶
Parameters: keycode [ KeyCode ]
Fires when key has been released
AxisValueChanged¶
Fires when analog input has been changed