A BaseInputModule for ray-based input, based on PointerInputModule
Inheritance
RayInputModule
public abstract class RayInputModule : BaseInputModule, IUsesViewerScale, IFunctionalitySubscriber<IProvidesViewerScale>, IFunctionalitySubscriber
Fields
Touch id for when simulating touches on a non touch device.
Declaration
public const int kFakeTouchesId = -4
Field Value
Id of the cached left mouse pointer event.
Declaration
public const int kMouseLeftId = -1
Field Value
Id of the cached middle mouse pointer event.
Declaration
public const int kMouseMiddleId = -3
Field Value
Id of the cached right mouse pointer event.
Declaration
public const int kMouseRightId = -2
Field Value
Declaration
protected Dictionary<int, RayEventData> m_RayData
Field Value
Methods
Declaration
protected override void Awake()
Clear all pointers and deselect any selected objects in the EventSystem.
Declaration
protected void ClearSelection()
Copy one RayEventData to another.
Declaration
protected void CopyFromTo(RayEventData from, RayEventData to)
Parameters
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.
|
Return the last RayEventData for the given touch / mouse id.
Declaration
protected RayEventData GetLastRayEventData(int id)
Parameters
Type |
Name |
Description |
Int32 |
id |
|
Returns
Return the current MouseState. Using the default pointer.
Declaration
protected virtual RayInputModule.RayMouseState GetMouseRayEventData()
Returns
Return the current MouseState.
Declaration
protected virtual RayInputModule.RayMouseState GetMouseRayEventData(int id)
Parameters
Type |
Name |
Description |
Int32 |
id |
|
Returns
Search the cache for currently active pointers, return true if found.
Declaration
protected bool GetRayData(int id, out RayEventData data, bool create)
Parameters
Returns
Type |
Description |
Boolean |
True if pointer is found.
|
Given a touch populate the RayEventData and return if we are pressed or released.
Declaration
protected RayEventData GetTouchRayEventData(Touch input, out bool pressed, out bool released)
Parameters
Type |
Name |
Description |
Touch |
input |
Touch being processed
|
Boolean |
pressed |
Are we pressed this frame
|
Boolean |
released |
Are we released this frame
|
Returns
Declaration
protected void HandlePointerExitAndEnter(RayEventData eventData, GameObject newEnterTarget, bool exitOnly = false)
Parameters
Declaration
public override bool IsPointerOverGameObject(int pointerId)
Parameters
Type |
Name |
Description |
Int32 |
pointerId |
|
Returns
Declaration
protected void OnPointerUp(RayEventData rayEvent, GameObject currentOverGo)
Parameters
Type |
Name |
Description |
RayEventData |
rayEvent |
|
GameObject |
currentOverGo |
|
Process the drag for the current frame with the given pointer event.
Declaration
protected virtual void ProcessDrag(RayEventData rayEvent, bool useWorldPosition = false)
Parameters
Process movement for the current frame with the given pointer event.
Declaration
protected virtual void ProcessMove(RayEventData pointerEvent)
Parameters
Remove the RayEventData from the cache.
Declaration
protected void RemoveRayData(RayEventData data)
Parameters
Given a mouse button return the current state for the frame.
Declaration
protected PointerEventData.FramePressState StateForMouseButton(int buttonId)
Parameters
Type |
Name |
Description |
Int32 |
buttonId |
Mouse button ID
|
Returns
Type |
Description |
PointerEventData.FramePressState |
|
Declaration
public override string ToString()
Returns
Events
Declaration
public event Action<GameObject, RayEventData> dragEnded
Event Type
Declaration
public event Action<GameObject, RayEventData> dragStarted
Event Type
Declaration
public event Action<GameObject, RayEventData> rayEntered
Event Type
Declaration
public event Action<GameObject, RayEventData> rayExited
Event Type
Declaration
public event Action<GameObject, RayEventData> rayHovering
Event Type
Explicit Interface Implementations
Declaration
IProvidesViewerScale IFunctionalitySubscriber<IProvidesViewerScale>.provider { get; set; }
Returns
Implements
Extension Methods