docs.unity3d.com
    Show / Hide Table of Contents

    Struct InputStateBlock

    Information about a memory region storing input state.

    Inherited Members
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    ValueType.ToString()
    Namespace: UnityEngine.InputSystem.LowLevel
    Syntax
    public struct InputStateBlock
    Remarks

    Input state is kept in raw memory blocks. All state is centrally managed by the input system; controls cannot keep their own independent state.

    Each state block is tagged with a format code indicating the storage format used for the memory block. This can either be one out of a set of primitive formats (such as "INT") or a custom format code indicating a more complex format.

    Memory using primitive formats can be converted to and from primitive values directly by this struct.

    State memory is bit-addressable, meaning that it can be offset from a byte address in bits (bitOffset) and is sized in bits instead of bytes (sizeInBits). However, in practice, bit-addressing memory reads and writes are only supported on the FormatBit.

    Input state memory is restricted to a maximum of 4GB in size. Offsets are recorded in 32 bits.

    Fields

    AutomaticOffset

    Declaration
    public const uint AutomaticOffset = 4294967294U
    Field Value
    Type Description
    UInt32

    FormatBit

    Format code for a variable-width bitfield representing an unsigned value, i.e. all bits including the highest one represent the magnitude of the value.

    Declaration
    public static readonly FourCC FormatBit
    Field Value
    Type Description
    FourCC
    See Also
    format

    FormatByte

    Format code for an 8-bit unsigned integer value.

    Declaration
    public static readonly FourCC FormatByte
    Field Value
    Type Description
    FourCC
    See Also
    format

    FormatDouble

    Format code for a 64-bit floating-point value.

    Declaration
    public static readonly FourCC FormatDouble
    Field Value
    Type Description
    FourCC
    See Also
    format

    FormatFloat

    Format code for a 32-bit floating-point value.

    Declaration
    public static readonly FourCC FormatFloat
    Field Value
    Type Description
    FourCC
    See Also
    format

    FormatInt

    Format code for a 32-bit signed integer value.

    Declaration
    public static readonly FourCC FormatInt
    Field Value
    Type Description
    FourCC
    See Also
    format

    FormatLong

    Format code for a 64-bit signed integer value.

    Declaration
    public static readonly FourCC FormatLong
    Field Value
    Type Description
    FourCC
    See Also
    format

    FormatQuaternion

    Declaration
    public static readonly FourCC FormatQuaternion
    Field Value
    Type Description
    FourCC

    FormatSBit

    Format code for a variable-width bitfield representing a signed value, i.e. the highest bit is used as a sign bit (0=unsigned, 1=signed) and the remaining bits represent the magnitude of the value.

    Declaration
    public static readonly FourCC FormatSBit
    Field Value
    Type Description
    FourCC
    See Also
    format

    FormatSByte

    Format code for an 8-bit signed integer value.

    Declaration
    public static readonly FourCC FormatSByte
    Field Value
    Type Description
    FourCC
    See Also
    format

    FormatShort

    Format code for a 16-bit signed integer value.

    Declaration
    public static readonly FourCC FormatShort
    Field Value
    Type Description
    FourCC
    See Also
    format

    FormatUInt

    Format code for a 32-bit unsigned integer value.

    Declaration
    public static readonly FourCC FormatUInt
    Field Value
    Type Description
    FourCC
    See Also
    format

    FormatULong

    Format code for a 64-bit unsigned integer value.

    Declaration
    public static readonly FourCC FormatULong
    Field Value
    Type Description
    FourCC
    See Also
    format

    FormatUShort

    Format code for a 16-bit unsigned integer value.

    Declaration
    public static readonly FourCC FormatUShort
    Field Value
    Type Description
    FourCC
    See Also
    format

    FormatVector2

    Declaration
    public static readonly FourCC FormatVector2
    Field Value
    Type Description
    FourCC

    FormatVector2Byte

    Declaration
    public static readonly FourCC FormatVector2Byte
    Field Value
    Type Description
    FourCC

    FormatVector2Short

    Declaration
    public static readonly FourCC FormatVector2Short
    Field Value
    Type Description
    FourCC

    FormatVector3

    Declaration
    public static readonly FourCC FormatVector3
    Field Value
    Type Description
    FourCC

    FormatVector3Byte

    Declaration
    public static readonly FourCC FormatVector3Byte
    Field Value
    Type Description
    FourCC

    FormatVector3Short

    Declaration
    public static readonly FourCC FormatVector3Short
    Field Value
    Type Description
    FourCC

    InvalidOffset

    Declaration
    public const uint InvalidOffset = 4294967295U
    Field Value
    Type Description
    UInt32

    Properties

    bitOffset

    Declaration
    public uint bitOffset { readonly get; set; }
    Property Value
    Type Description
    UInt32

    byteOffset

    Declaration
    public uint byteOffset { readonly get; set; }
    Property Value
    Type Description
    UInt32

    format

    Type identifier for the memory layout used by the state.

    Declaration
    public FourCC format { readonly get; set; }
    Property Value
    Type Description
    FourCC
    Remarks

    Used for safety checks to make sure that when the system copies state memory, it copies between compatible layouts. If set to a primitive state format, also used to determine the size of the state block.

    sizeInBits

    Declaration
    public uint sizeInBits { readonly get; set; }
    Property Value
    Type Description
    UInt32

    Methods

    CopyToFrom(Void*, Void*)

    Declaration
    public void CopyToFrom(void *toStatePtr, void *fromStatePtr)
    Parameters
    Type Name Description
    Void* toStatePtr
    Void* fromStatePtr

    GetPrimitiveFormatFromType(Type)

    Declaration
    public static FourCC GetPrimitiveFormatFromType(Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    FourCC

    GetSizeOfPrimitiveFormatInBits(FourCC)

    Declaration
    public static int GetSizeOfPrimitiveFormatInBits(FourCC type)
    Parameters
    Type Name Description
    FourCC type
    Returns
    Type Description
    Int32

    ReadDouble(Void*)

    Declaration
    public double ReadDouble(void *statePtr)
    Parameters
    Type Name Description
    Void* statePtr
    Returns
    Type Description
    Double

    ReadFloat(Void*)

    Declaration
    public float ReadFloat(void *statePtr)
    Parameters
    Type Name Description
    Void* statePtr
    Returns
    Type Description
    Single

    ReadInt(Void*)

    Declaration
    public int ReadInt(void *statePtr)
    Parameters
    Type Name Description
    Void* statePtr
    Returns
    Type Description
    Int32

    Write(Void*, PrimitiveValue)

    Declaration
    public void Write(void *statePtr, PrimitiveValue value)
    Parameters
    Type Name Description
    Void* statePtr
    PrimitiveValue value

    WriteDouble(Void*, Double)

    Declaration
    public void WriteDouble(void *statePtr, double value)
    Parameters
    Type Name Description
    Void* statePtr
    Double value

    WriteFloat(Void*, Single)

    Declaration
    public void WriteFloat(void *statePtr, float value)
    Parameters
    Type Name Description
    Void* statePtr
    Single value

    WriteInt(Void*, Int32)

    Declaration
    public void WriteInt(void *statePtr, int value)
    Parameters
    Type Name Description
    Void* statePtr
    Int32 value

    See Also

    stateBlock
    Back to top
    Terms of use
    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