Class PointerInputModule
A BaseInputModule for pointer input.
Inheritance
Inherited Members
Namespace: UnityEngine.EventSystems
Assembly: UnityEngine.UI.dll
Syntax
public abstract class PointerInputModule : BaseInputModule
Fields
kFakeTouchesId
Touch id for when simulating touches on a non touch device.
Declaration
public const int kFakeTouchesId = -4
Field Value
Type | Description |
---|---|
int |
kMouseLeftId
Id of the cached left mouse pointer event.
Declaration
public const int kMouseLeftId = -1
Field Value
Type | Description |
---|---|
int |
kMouseMiddleId
Id of the cached middle mouse pointer event.
Declaration
public const int kMouseMiddleId = -3
Field Value
Type | Description |
---|---|
int |
kMouseRightId
Id of the cached right mouse pointer event.
Declaration
public const int kMouseRightId = -2
Field Value
Type | Description |
---|---|
int |
m_PointerData
Declaration
protected Dictionary<int, PointerEventData> m_PointerData
Field Value
Type | Description |
---|---|
Dictionary<int, PointerEventData> |
Methods
ClearSelection()
Clear all pointers and deselect any selected objects in the EventSystem.
Declaration
protected void ClearSelection()
CopyFromTo(PointerEventData, PointerEventData)
Copy one PointerEventData to another.
Declaration
protected void CopyFromTo(PointerEventData from, PointerEventData to)
Parameters
Type | Name | Description |
---|---|---|
PointerEventData | from | |
PointerEventData | to |
DeselectIfSelectionChanged(GameObject, BaseEventData)
Deselect the current selected GameObject if the currently pointed-at GameObject is different.
Declaration
protected void DeselectIfSelectionChanged(GameObject currentOverGo, BaseEventData pointerEvent)
Parameters
Type | Name | Description |
---|---|---|
GameObject | currentOverGo | The GameObject the pointer is currently over. |
BaseEventData | pointerEvent | Current event data. |
GetLastPointerEventData(int)
Return the last PointerEventData for the given touch / mouse id.
Declaration
protected PointerEventData GetLastPointerEventData(int id)
Parameters
Type | Name | Description |
---|---|---|
int | id |
Returns
Type | Description |
---|---|
PointerEventData |
GetMousePointerEventData()
Return the current MouseState. Using the default pointer.
Declaration
protected virtual PointerInputModule.MouseState GetMousePointerEventData()
Returns
Type | Description |
---|---|
PointerInputModule.MouseState |
GetMousePointerEventData(int)
Return the current MouseState.
Declaration
protected virtual PointerInputModule.MouseState GetMousePointerEventData(int id)
Parameters
Type | Name | Description |
---|---|---|
int | id |
Returns
Type | Description |
---|---|
PointerInputModule.MouseState |
GetPointerData(int, out PointerEventData, bool)
Search the cache for currently active pointers, return true if found.
Declaration
protected bool GetPointerData(int id, out PointerEventData data, bool create)
Parameters
Type | Name | Description |
---|---|---|
int | id | Touch ID |
PointerEventData | data | Found data |
bool | create | If not found should it be created |
Returns
Type | Description |
---|---|
bool | True if pointer is found. |
GetTouchPointerEventData(Touch, out bool, out bool)
Given a touch populate the PointerEventData and return if we are pressed or released.
Declaration
protected PointerEventData GetTouchPointerEventData(Touch input, out bool pressed, out bool released)
Parameters
Type | Name | Description |
---|---|---|
Touch | input | Touch being processed |
bool | pressed | Are we pressed this frame |
bool | released | Are we released this frame |
Returns
Type | Description |
---|---|
PointerEventData |
IsPointerOverGameObject(int)
If the module is pointer based, then override this to return true if the pointer is over an event system object.
Declaration
public override bool IsPointerOverGameObject(int pointerId)
Parameters
Type | Name | Description |
---|---|---|
int | pointerId | Pointer ID |
Returns
Type | Description |
---|---|
bool | Is the given pointer over an event system object? |
Overrides
ProcessDrag(PointerEventData)
Process the drag for the current frame with the given pointer event.
Declaration
protected virtual void ProcessDrag(PointerEventData pointerEvent)
Parameters
Type | Name | Description |
---|---|---|
PointerEventData | pointerEvent |
ProcessMove(PointerEventData)
Process movement for the current frame with the given pointer event.
Declaration
protected virtual void ProcessMove(PointerEventData pointerEvent)
Parameters
Type | Name | Description |
---|---|---|
PointerEventData | pointerEvent |
RemovePointerData(PointerEventData)
Remove the PointerEventData from the cache.
Declaration
protected void RemovePointerData(PointerEventData data)
Parameters
Type | Name | Description |
---|---|---|
PointerEventData | data |
StateForMouseButton(int)
Given a mouse button return the current state for the frame.
Declaration
protected PointerEventData.FramePressState StateForMouseButton(int buttonId)
Parameters
Type | Name | Description |
---|---|---|
int | buttonId | Mouse button ID |
Returns
Type | Description |
---|---|
PointerEventData.FramePressState |
ToString()
Returns the name of the object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | The name returned by ToString. |