Interface IHaptics
Base interface for haptics on input devices.
Namespace: UnityEngine.InputSystem.Haptics
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
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.
ResumeHaptics()
Resume haptics playback on the device.
Declaration
void ResumeHaptics()
Remarks
Should be called after calling PauseHaptics(). Otherwise does nothing.