docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct InputEventPtr

    Pointer to an InputEvent. Makes it easier to work with InputEvents and hides the unsafe operations necessary to work with them.

    Implements
    IEquatable<InputEventPtr>
    Namespace: UnityEngine.InputSystem.LowLevel
    Assembly: Unity.InputSystem.dll
    Syntax
    public struct InputEventPtr : IEquatable<InputEventPtr>
    Remarks

    Note that event pointers generally refer to event buffers that are continually reused. This means that event pointers should not be held on to. Instead, to hold onto event data, manually copy an event to a buffer.

    Constructors

    InputEventPtr(InputEvent*)

    Initialize the pointer to refer to the given event.

    Declaration
    public InputEventPtr(InputEvent* eventPtr)
    Parameters
    Type Name Description
    InputEvent* eventPtr

    Pointer to an event. Can be null.

    Properties

    data

    Declaration
    public InputEvent* data { get; }
    Property Value
    Type Description
    InputEvent*

    deviceId

    Declaration
    public int deviceId { get; set; }
    Property Value
    Type Description
    int

    handled

    Whether the event is considered "handled" and should not be processed further.

    Declaration
    public bool handled { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    This is used in two ways. Setting it from inside onEvent will cause the event to not be processed further. If it is a StateEvent or DeltaStateEvent, the InputDevice targeted by the event will not receive the state change.

    Setting this flag from inside a state change monitor (see AddChangeMonitor(InputControl, IInputStateChangeMonitor, long, uint)) will prevent other monitors on the same IInputStateChangeMonitor not receiving the state change.

    Exceptions
    Type Condition
    InvalidOperationException

    The event pointer instance is not valid.

    id

    Declaration
    public int id { get; set; }
    Property Value
    Type Description
    int

    sizeInBytes

    Declaration
    public uint sizeInBytes { get; }
    Property Value
    Type Description
    uint

    time

    Declaration
    public double time { get; set; }
    Property Value
    Type Description
    double

    type

    Declaration
    public FourCC type { get; }
    Property Value
    Type Description
    FourCC

    valid

    Whether the pointer is not null.

    Declaration
    public bool valid { get; }
    Property Value
    Type Description
    bool

    True if the struct refers to an event.

    Methods

    Equals(object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj
    Returns
    Type Description
    bool
    Overrides
    ValueType.Equals(object)

    Equals(InputEventPtr)

    Declaration
    public bool Equals(InputEventPtr other)
    Parameters
    Type Name Description
    InputEventPtr other
    Returns
    Type Description
    bool

    From(InputEvent*)

    Declaration
    public static InputEventPtr From(InputEvent* eventPtr)
    Parameters
    Type Name Description
    InputEvent* eventPtr
    Returns
    Type Description
    InputEventPtr

    FromInputEventPtr(InputEventPtr)

    Declaration
    public static InputEvent* FromInputEventPtr(InputEventPtr eventPtr)
    Parameters
    Type Name Description
    InputEventPtr eventPtr
    Returns
    Type Description
    InputEvent*

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    ValueType.GetHashCode()

    IsA<TOtherEvent>()

    Declaration
    public bool IsA<TOtherEvent>() where TOtherEvent : struct, IInputEventTypeInfo
    Returns
    Type Description
    bool
    Type Parameters
    Name Description
    TOtherEvent

    Next()

    Declaration
    public InputEventPtr Next()
    Returns
    Type Description
    InputEventPtr

    ToPointer()

    Return the plain pointer wrapped around by the struct.

    Declaration
    public InputEvent* ToPointer()
    Returns
    Type Description
    InputEvent*

    A plain pointer. Can be null.

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    ValueType.ToString()

    Operators

    operator ==(InputEventPtr, InputEventPtr)

    Declaration
    public static bool operator ==(InputEventPtr left, InputEventPtr right)
    Parameters
    Type Name Description
    InputEventPtr left
    InputEventPtr right
    Returns
    Type Description
    bool

    implicit operator InputEventPtr(InputEvent*)

    Declaration
    public static implicit operator InputEventPtr(InputEvent* eventPtr)
    Parameters
    Type Name Description
    InputEvent* eventPtr
    Returns
    Type Description
    InputEventPtr

    implicit operator InputEvent*(InputEventPtr)

    Declaration
    public static implicit operator InputEvent*(InputEventPtr eventPtr)
    Parameters
    Type Name Description
    InputEventPtr eventPtr
    Returns
    Type Description
    InputEvent*

    operator !=(InputEventPtr, InputEventPtr)

    Declaration
    public static bool operator !=(InputEventPtr left, InputEventPtr right)
    Parameters
    Type Name Description
    InputEventPtr left
    InputEventPtr right
    Returns
    Type Description
    bool

    Implements

    IEquatable<T>

    Extension Methods

    InputControlExtensions.EnumerateChangedControls(InputEventPtr, InputDevice, float)
    InputControlExtensions.EnumerateControls(InputEventPtr, InputControlExtensions.Enumerate, InputDevice, float)
    InputControlExtensions.GetAllButtonPresses(InputEventPtr, float, bool)
    InputControlExtensions.GetFirstButtonPressOrNull(InputEventPtr, float, bool)
    InputControlExtensions.HasButtonPress(InputEventPtr, float, bool)

    Did you find this page useful? Please give it a rating:

    Thanks for rating this page!

    Report a problem on this page

    What kind of problem would you like to report?

    • This page needs code samples
    • Code samples do not work
    • Information is missing
    • Information is incorrect
    • Information is unclear or confusing
    • There is a spelling/grammar error on this page
    • Something else

    Thanks for letting us know! This page has been marked for review based on your feedback.

    If you have time, you can provide more information to help us fix the problem faster.

    Provide more information

    You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:

    You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:

    You've told us there is information missing from this page. Please tell us more about what's missing:

    You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:

    You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:

    You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:

    You've told us this page has a problem. Please tell us more about what's wrong:

    Thank you for helping to make the Unity documentation better!

    Your feedback has been submitted as a ticket for our documentation team to review.

    We are not able to reply to every ticket submitted.

    In This Article
    • Constructors
      • InputEventPtr(InputEvent*)
    • Properties
      • data
      • deviceId
      • handled
      • id
      • sizeInBytes
      • time
      • type
      • valid
    • Methods
      • Equals(object)
      • Equals(InputEventPtr)
      • From(InputEvent*)
      • FromInputEventPtr(InputEventPtr)
      • GetHashCode()
      • IsA<TOtherEvent>()
      • Next()
      • ToPointer()
      • ToString()
    • Operators
      • operator ==(InputEventPtr, InputEventPtr)
      • implicit operator InputEventPtr(InputEvent*)
      • implicit operator InputEvent*(InputEventPtr)
      • operator !=(InputEventPtr, InputEventPtr)
    • Implements
    • Extension Methods
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)