Inherited Members
Unity.Entities.SystemBase.OnCreateForCompiler()
public class InputSystem : SystemBase
Fields
Declaration
protected InputData m_inputState
Field Value
Properties
If this setting is enabled, rotation values reported by sensors are rotated around the Z axis as follows:
for devices with natural Portrait orientation
ScreenOrientation.Portrait - values remain unchanged.
ScreenOrientation.PortraitUpsideDown - values rotate by 180 degrees.
ScreenOrientation.LandscapeLeft - values rotate by 90 degrees.
ScreenOrientation.LandscapeRight - values rotate by 270 degrees.
for devices with natural Landscape orientation
ScreenOrientation.LandscapeRight - values remain unchanged.
ScreenOrientation.Portrait - values rotate by 270 degrees.
ScreenOrientation.PortraitUpsideDown - values rotate by 90 degrees.
ScreenOrientation.LandscapeLeft - values rotate by 180 degrees.
This setting is enabled by default.
Declaration
public bool CompensateForScreenOrientation { get; set; }
Property Value
Methods
Declaration
protected virtual Sensor CreateSensor(ComponentType type)
Parameters
Returns
Declaration
public void DisableSensor<T>()
where T : struct, IComponentData
Type Parameters
Declaration
public void EnableSensor<T>()
where T : struct, IComponentData
Type Parameters
Returns the input delta in screen pixels for this frame. For touch input this is
the first touch. For mouse input, it is the mouse position delta.
Declaration
public float2 GetInputDelta()
Returns
Returns the input position in screen pixels. For touch input this is
the first touch. For mouse input, it is the mouse position.
Declaration
public float2 GetInputPosition()
Returns
Returns the current input scroll delta in screen pixels for this frame.
Declaration
public float2 GetInputScrollDelta()
Returns
Returns true if the key is currently held down.
Declaration
public bool GetKey(KeyCode key)
Parameters
Returns
Returns true if the key was pressed in the current frame.
Declaration
public bool GetKeyDown(KeyCode key)
Parameters
Returns
Returns true if the key was released in the current frame.
Declaration
public bool GetKeyUp(KeyCode key)
Parameters
Returns
Returns true if the mouse button is currently held down.
Declaration
public bool GetMouseButton(int button)
Parameters
Type |
Name |
Description |
Int32 |
button |
|
Returns
Returns true if the mouse button was pressed in the current frame.
Declaration
public bool GetMouseButtonDown(int button)
Parameters
Type |
Name |
Description |
Int32 |
button |
|
Returns
Returns true if the mouse button was released in the current frame.
Declaration
public bool GetMouseButtonUp(int button)
Parameters
Type |
Name |
Description |
Int32 |
button |
|
Returns
Returns the current mouse pointer type.
Declaration
public virtual PointerModeType GetMouseMode()
Returns
Declaration
protected virtual int GetRotationIndex(ScreenOrientation orientation)
Parameters
Returns
Declaration
public int GetSensorSamplingFrequency<T>()
where T : struct, IComponentData
Returns
Type Parameters
Retrieves information for a specific touch point. The index ranges
from 0 to the value returned by TouchCount.
Declaration
public Touch GetTouch(int index)
Parameters
Type |
Name |
Description |
Int32 |
index |
|
Returns
Convenience function that returns the value from GetInputPosition transformed
into world space. World space includes the camera transform of the camera
closest to the input position.
This is the same as TranslateScreenToWorld(GetInputPosition());
In 2D setups, the world z coordinate is always set to 0.
Declaration
public float3 GetWorldInputPosition()
Returns
Declaration
protected virtual bool IsAvailable(ComponentType type)
Parameters
Returns
Declaration
public bool IsAvailable<T>()
where T : struct, IComponentData
Returns
Type Parameters
Returns true if mouse events are emulated by other input devices, such as touch.
Declaration
public bool IsMouseEmulated()
Returns
Returns true if the current device produces mouse input.
Declaration
public bool IsMousePresent()
Returns
Returns true if the current device produces touch input responses.
This value may not be accurate until a first touch occurs.
Declaration
public bool IsTouchSupported()
Returns
Declaration
protected void MouseEmulateReset()
Declaration
protected override void OnCreate()
Overrides
Declaration
protected override void OnDestroy()
Overrides
Declaration
protected override void OnUpdate()
Overrides
Declaration
protected void ProcessTouch(int id, TouchState state, int x, int y)
Parameters
Sets mouse pointer mode to normal, hidden, or locked if mouse is available on the platform.
Declaration
public virtual void SetMouseMode(PointerModeType type)
Parameters
Declaration
public void SetSensorSamplingFrequency<T>(int freq)
where T : IComponentData
Parameters
Type |
Name |
Description |
Int32 |
freq |
|
Type Parameters
Returns the number of currently active touches.
Declaration
Returns
Transforms Screen coordinates into World coordinates.
World space includes the camera transform of the camera closest to
the input coordinate.
In 2D setups, the world z coordinate is always set to 0.
Declaration
public float3 TranslateScreenToWorld(float2 screenCoord)
Parameters
Type |
Name |
Description |
float2 |
screenCoord |
|
Returns