Class RayInputModule | Unity Reflect | 1.0.0-preview.11
docs.unity3d.com
    Show / Hide Table of Contents

    Class RayInputModule

    A BaseInputModule for ray-based input, based on PointerInputModule

    Inheritance
    Object
    RayInputModule
    MultipleRayInputModule
    Namespace: UnityEngine.EventSystems
    Syntax
    public abstract class RayInputModule : BaseInputModule, IUsesViewerScale, IFunctionalitySubscriber<IProvidesViewerScale>, IFunctionalitySubscriber

    Fields

    kFakeTouchesId

    Touch id for when simulating touches on a non touch device.

    Declaration
    public const int kFakeTouchesId = -4
    Field Value
    Type Description
    Int32

    kMouseLeftId

    Id of the cached left mouse pointer event.

    Declaration
    public const int kMouseLeftId = -1
    Field Value
    Type Description
    Int32

    kMouseMiddleId

    Id of the cached middle mouse pointer event.

    Declaration
    public const int kMouseMiddleId = -3
    Field Value
    Type Description
    Int32

    kMouseRightId

    Id of the cached right mouse pointer event.

    Declaration
    public const int kMouseRightId = -2
    Field Value
    Type Description
    Int32

    m_RayData

    Declaration
    protected Dictionary<int, RayEventData> m_RayData
    Field Value
    Type Description
    Dictionary<Int32, RayEventData>

    Methods

    Awake()

    Declaration
    protected override void Awake()

    ClearSelection()

    Clear all pointers and deselect any selected objects in the EventSystem.

    Declaration
    protected void ClearSelection()

    CopyFromTo(RayEventData, RayEventData)

    Copy one RayEventData to another.

    Declaration
    protected void CopyFromTo(RayEventData from, RayEventData to)
    Parameters
    Type Name Description
    RayEventData from
    RayEventData 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.

    GetLastRayEventData(Int32)

    Return the last RayEventData for the given touch / mouse id.

    Declaration
    protected RayEventData GetLastRayEventData(int id)
    Parameters
    Type Name Description
    Int32 id
    Returns
    Type Description
    RayEventData

    GetMouseRayEventData()

    Return the current MouseState. Using the default pointer.

    Declaration
    protected virtual RayInputModule.RayMouseState GetMouseRayEventData()
    Returns
    Type Description
    RayInputModule.RayMouseState

    GetMouseRayEventData(Int32)

    Return the current MouseState.

    Declaration
    protected virtual RayInputModule.RayMouseState GetMouseRayEventData(int id)
    Parameters
    Type Name Description
    Int32 id
    Returns
    Type Description
    RayInputModule.RayMouseState

    GetRayData(Int32, out RayEventData, Boolean)

    Search the cache for currently active pointers, return true if found.

    Declaration
    protected bool GetRayData(int id, out RayEventData data, bool create)
    Parameters
    Type Name Description
    Int32 id

    Touch ID

    RayEventData data

    Found data

    Boolean create

    If not found should it be created

    Returns
    Type Description
    Boolean

    True if pointer is found.

    GetTouchRayEventData(Touch, out Boolean, out Boolean)

    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
    Type Description
    RayEventData

    HandlePointerExitAndEnter(RayEventData, GameObject, Boolean)

    Declaration
    protected void HandlePointerExitAndEnter(RayEventData eventData, GameObject newEnterTarget, bool exitOnly = false)
    Parameters
    Type Name Description
    RayEventData eventData
    GameObject newEnterTarget
    Boolean exitOnly

    IsPointerOverGameObject(Int32)

    Declaration
    public override bool IsPointerOverGameObject(int pointerId)
    Parameters
    Type Name Description
    Int32 pointerId
    Returns
    Type Description
    Boolean

    OnPointerUp(RayEventData, GameObject)

    Declaration
    protected void OnPointerUp(RayEventData rayEvent, GameObject currentOverGo)
    Parameters
    Type Name Description
    RayEventData rayEvent
    GameObject currentOverGo

    ProcessDrag(RayEventData, Boolean)

    Process the drag for the current frame with the given pointer event.

    Declaration
    protected virtual void ProcessDrag(RayEventData rayEvent, bool useWorldPosition = false)
    Parameters
    Type Name Description
    RayEventData rayEvent
    Boolean useWorldPosition

    ProcessMove(RayEventData)

    Process movement for the current frame with the given pointer event.

    Declaration
    protected virtual void ProcessMove(RayEventData pointerEvent)
    Parameters
    Type Name Description
    RayEventData pointerEvent

    RemoveRayData(RayEventData)

    Remove the RayEventData from the cache.

    Declaration
    protected void RemoveRayData(RayEventData data)
    Parameters
    Type Name Description
    RayEventData data

    StateForMouseButton(Int32)

    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

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    Events

    dragEnded

    Declaration
    public event Action<GameObject, RayEventData> dragEnded
    Event Type
    Type Description
    Action<GameObject, RayEventData>

    dragStarted

    Declaration
    public event Action<GameObject, RayEventData> dragStarted
    Event Type
    Type Description
    Action<GameObject, RayEventData>

    rayEntered

    Declaration
    public event Action<GameObject, RayEventData> rayEntered
    Event Type
    Type Description
    Action<GameObject, RayEventData>

    rayExited

    Declaration
    public event Action<GameObject, RayEventData> rayExited
    Event Type
    Type Description
    Action<GameObject, RayEventData>

    rayHovering

    Declaration
    public event Action<GameObject, RayEventData> rayHovering
    Event Type
    Type Description
    Action<GameObject, RayEventData>

    Explicit Interface Implementations

    IFunctionalitySubscriber<IProvidesViewerScale>.provider

    Declaration
    IProvidesViewerScale IFunctionalitySubscriber<IProvidesViewerScale>.provider { get; set; }
    Returns
    Type Description
    IProvidesViewerScale
    Implements
    IFunctionalitySubscriber<TProvider>.provider

    Extension Methods

    FunctionalitySubscriberMethods.HasProvider<TProvider>(IFunctionalitySubscriber<TProvider>)
    UsesViewerScaleMethods.GetViewerScale(IUsesViewerScale)
    UsesViewerScaleMethods.SetViewerScale(IUsesViewerScale, Single)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023