Attention
You are viewing PyUnity docs under the develop
branch.
As such, they are only applicable if you installed from source.
Go to https://docs.pyunity.x10.bz/en/latest/ for the most recent
release.
pyunity.input module¶
Source code: pyunity/input.py
- class pyunity.input.Input[source]¶
Bases:
object
- classmethod GetKey(keycode)[source]¶
Check if key is pressed at moment of function call
- Parameters:
keycode (KeyCode) – Key to query
- Returns:
If the key is pressed
- Return type:
boolean
- classmethod GetKeyUp(keycode)[source]¶
Check if key was released this frame.
- Parameters:
keycode (KeyCode) – Key to query
- Returns:
If the key was released
- Return type:
boolean
- classmethod GetKeyDown(keycode)[source]¶
Check if key was pressed down this frame.
- Parameters:
keycode (KeyCode) – Key to query
- Returns:
If the key was pressed down
- Return type:
boolean
- classmethod GetMouse(mousecode)[source]¶
Check if mouse button is pressed at moment of function call
- Parameters:
mousecode (MouseCode) – Mouse button to query
- Returns:
If the mouse button is pressed
- Return type:
boolean
- classmethod GetMouseUp(mousecode)[source]¶
Check if mouse button was released this frame.
- Parameters:
mousecode (MouseCode) – Mouse button to query
- Returns:
If the mouse button was released
- Return type:
boolean
- classmethod GetMouseDown(mousecode)[source]¶
Check if mouse button was pressed down this frame.
- Parameters:
mousecode (MouseCode) – Mouse button to query
- Returns:
If the mouse button was pressed down
- Return type:
boolean
- classmethod GetMouseState(mousecode, mousestate)[source]¶
Check for mouse button state at moment of function call
- classmethod GetAxis(axis)[source]¶
Get the value for the specified axis. This is always between -1 and 1.
- Parameters:
axis (str) – Specified axis
- Returns:
Axis value
- Return type:
- Raises:
PyUnityException – If the axis is not a valid axis
- classmethod GetRawAxis(axis)[source]¶
Get the raw value for the specified axis. This is always either -1, 0 or 1.
- Parameters:
axis (str) – Specified axis
- Returns:
Raw axis value
- Return type:
- Raises:
PyUnityException – If the axis is not a valid axis