using UnityEngine.InputSystem; using UnityEngine.Scripting; namespace UnityEngine.XR.OpenXR.Input { /// /// Data that the HapticControl represents. Since haptics are an Output the Haptic struct is empty. /// public struct Haptic { } /// /// Input System control that wraps up a structure. /// [Preserve] public class HapticControl : InputControl { /// /// Default Constructor required by the Input System for instantiation. /// public HapticControl() { // Since the haptic control has no children and the the Haptic data structure has no members we need // to fake having a size or the InputSystem will think this control is misconfigured and throw an exception. m_StateBlock.sizeInBits = 1; m_StateBlock.bitOffset = 0; m_StateBlock.byteOffset = 0; } /// /// Returns an empty haptic structure since haptics are an output and have no data /// /// Raw state data to read from /// Empty haptic structure public override unsafe Haptic ReadUnprocessedValueFromState(void* statePtr) => new Haptic(); } }