InputService¶
InputService is a class used for retrieving user input data, such as the mouse and keyboard.
Inherits: Instance
Properties¶
- IsWindowFocused:
boolean - IsTouchscreen:
boolean - IsGameFocused:
boolean - IsInputFocused:
boolean - IsGamepadConnected:
boolean - IsMenuOpened:
boolean - CursorLocked:
boolean - CursorVisible:
boolean - MousePosition:
Vector2 - ScreenWidth:
number - ScreenHeight:
number
Methods¶
GetMouseWorldPosition(ignoreList: { Instance }) → Vector3¶
Returns the 3D world-space position corresponding to the current mouse cursor location.
GetVector2(actionName: string) → InputActionVector2¶
Returns the current Vector2 value of the action.
GetButton(actionName: string) → InputActionButton¶
Returns true if the specified button is being held down.
GetAxis(actionName: string) → InputActionAxis¶
Returns the value of the specified axis.
BindButton(name: string) → InputActionButton¶
Bind new Button Input Action
BindAxis(name: string) → InputActionAxis¶
Bind new Axis Input Action
BindVector2(name: string) → InputActionVector2¶
Bind new Vector2 Input Action
Events¶
- GameFocused: Fires when the game has been focused
- GameUnfocused: Fires when the game has been unfocused
- GamepadConnected: Fires when gamepad is connected
- GamepadDisconnected: Fires when gamepad has been disconnected
- KeyDown: Fires when key has been pressed
- KeyUp: Fires when key has been released
- AxisValueChanged: Fires when analog input has been changed