Class BaseInputModule
Inherited Members
Namespace: UnityEngine.EventSystems
Syntax
[RequireComponent(typeof(EventSystem))]
public abstract class BaseInputModule : UIBehaviour
Fields
m_InputOverride
Declaration
protected BaseInput m_InputOverride
Field Value
| Type | Description |
|---|---|
| BaseInput |
m_RaycastResultCache
Declaration
[NonSerialized]
protected List<RaycastResult> m_RaycastResultCache
Field Value
| Type | Description |
|---|---|
| List<RaycastResult> |
Properties
eventSystem
Declaration
protected EventSystem eventSystem { get; }
Property Value
| Type | Description |
|---|---|
| EventSystem |
input
The current BaseInput being used by the input module.
Declaration
public BaseInput input { get; }
Property Value
| Type | Description |
|---|---|
| BaseInput |
inputOverride
Used to override the default BaseInput for the input module.
Declaration
public BaseInput inputOverride { get; set; }
Property Value
| Type | Description |
|---|---|
| BaseInput |
Remarks
With this it is possible to bypass the Input system with your own but still use the same InputModule. For example this can be used to feed fake input into the UI or interface with a different input system.
Methods
ActivateModule()
Called when the module is activated. Override this if you want custom code to execute when you activate your module.
Declaration
public virtual void ActivateModule()
ConvertUIToolkitPointerId(PointerEventData)
Returns Id of the pointer following PointerId convention.
Declaration
public virtual int ConvertUIToolkitPointerId(PointerEventData sourcePointerData)
Parameters
| Type | Name | Description |
|---|---|---|
| PointerEventData | sourcePointerData | PointerEventData whose pointerId will be converted to UI Toolkit pointer convention. |
Returns
| Type | Description |
|---|---|
| Int32 |
See Also
DeactivateModule()
Called when the module is deactivated. Override this if you want custom code to execute when you deactivate your module.
Declaration
public virtual void DeactivateModule()
DetermineMoveDirection(Single, Single)
Given an input movement, determine the best MoveDirection.
Declaration
protected static MoveDirection DetermineMoveDirection(float x, float y)
Parameters
| Type | Name | Description |
|---|---|---|
| Single | x | X movement. |
| Single | y | Y movement. |
Returns
| Type | Description |
|---|---|
| MoveDirection |
DetermineMoveDirection(Single, Single, Single)
Given an input movement, determine the best MoveDirection.
Declaration
protected static MoveDirection DetermineMoveDirection(float x, float y, float deadZone)
Parameters
| Type | Name | Description |
|---|---|---|
| Single | x | X movement. |
| Single | y | Y movement. |
| Single | deadZone | Dead zone. |
Returns
| Type | Description |
|---|---|
| MoveDirection |
FindCommonRoot(GameObject, GameObject)
Given 2 GameObjects, return a common root GameObject (or null).
Declaration
protected static GameObject FindCommonRoot(GameObject g1, GameObject g2)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | g1 | GameObject to compare |
| GameObject | g2 | GameObject to compare |
Returns
| Type | Description |
|---|---|
| GameObject |
FindFirstRaycast(List<RaycastResult>)
Return the first valid RaycastResult.
Declaration
protected static RaycastResult FindFirstRaycast(List<RaycastResult> candidates)
Parameters
| Type | Name | Description |
|---|---|---|
| List<RaycastResult> | candidates |
Returns
| Type | Description |
|---|---|
| RaycastResult |
GetAxisEventData(Single, Single, Single)
Given some input data generate an AxisEventData that can be used by the event system.
Declaration
protected virtual AxisEventData GetAxisEventData(float x, float y, float moveDeadZone)
Parameters
| Type | Name | Description |
|---|---|---|
| Single | x | X movement. |
| Single | y | Y movement. |
| Single | moveDeadZone |
Returns
| Type | Description |
|---|---|
| AxisEventData |
GetBaseEventData()
Generate a BaseEventData that can be used by the EventSystem.
Declaration
protected virtual BaseEventData GetBaseEventData()
Returns
| Type | Description |
|---|---|
| BaseEventData |
HandlePointerExitAndEnter(PointerEventData, GameObject)
Declaration
protected void HandlePointerExitAndEnter(PointerEventData currentPointerData, GameObject newEnterTarget)
Parameters
| Type | Name | Description |
|---|---|---|
| PointerEventData | currentPointerData | |
| GameObject | newEnterTarget |
IsModuleSupported()
Check to see if the module is supported. Override this if you have a platform specific module (eg. TouchInputModule that you do not want to activate on standalone.)
Declaration
public virtual bool IsModuleSupported()
Returns
| Type | Description |
|---|---|
| Boolean | Is the module supported. |
IsPointerOverGameObject(Int32)
If the module is pointer based, then override this to return true if the pointer is over an event system object.
Declaration
public virtual bool IsPointerOverGameObject(int pointerId)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | pointerId | Pointer ID |
Returns
| Type | Description |
|---|---|
| Boolean | Is the given pointer over an event system object? |
OnDisable()
Declaration
protected override void OnDisable()
Overrides
OnEnable()
Declaration
protected override void OnEnable()
Overrides
Process()
Process the current tick for the module.
Declaration
public abstract void Process()
ShouldActivateModule()
Should the module be activated.
Declaration
public virtual bool ShouldActivateModule()
Returns
| Type | Description |
|---|---|
| Boolean |
UpdateModule()
Update the internal state of the Module.
Declaration
public virtual void UpdateModule()