docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface IHaptics

    Base interface for haptics on input devices.

    Namespace: UnityEngine.InputSystem.Haptics
    Assembly: Unity.InputSystem.dll
    Syntax
    public interface IHaptics
    Remarks

    To support haptics, an InputDevice has to implement one or more haptics interfaces.

    Examples
    class MyDevice : InputDevice, IDualMotorRumble
    {
        private DualMotorRumble m_Rumble;
    
        public void SetMotorSpeeds(float lowFrequency, float highFrequency)
        {
            m_Rumble.SetMotorSpeeds(lowFrequency, highFrequency);
        }
    
        public void PauseHaptics()
        {
            m_Rumble.PauseHaptics();
        }
    
        public void ResumeHaptics()
        {
            m_Rumble.ResumeHaptics();
        }
    
        public void ResetHaptics()
        {
            m_Rumble.ResetHaptics();
        }
    }

    Methods

    PauseHaptics()

    Pause haptics playback on the device.

    Declaration
    void PauseHaptics()
    Remarks

    This should preserve current playback settings (such as motor speed levels or effect playback positions) but shut down feedback effects on the device.

    If proper resumption of effects is not possible, playback should be stopped and ResumeHaptics() is allowed to be a no-operation.

    Note that haptics playback states are not required to survive domain reloads in the editor.

    See Also
    ResumeHaptics()

    ResetHaptics()

    Reset haptics playback on the device to its default state.

    Declaration
    void ResetHaptics()
    Remarks

    This will turn off all haptics effects that may be playing on the device.

    See Also
    PauseHaptics()
    ResumeHaptics()
    ResetHaptics()

    ResumeHaptics()

    Resume haptics playback on the device.

    Declaration
    void ResumeHaptics()
    Remarks

    Should be called after calling PauseHaptics(). Otherwise does nothing.

    See Also
    PauseHaptics()
    ResumeHaptics()
    ResetHaptics()

    See Also

    PauseHaptics()
    ResumeHaptics()
    ResetHaptics()
    In This Article
    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)