0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

はじめてのアドベントカレンダーAdvent Calendar 2023

Day 3

【最新】Unity でiOS, Android バイブレーションを簡単に共通化!Nice vibration, Feelを使って手軽に!

Posted at

Unityで人気のアセット、Nice Vibration(Feelに統合された)のプリセットバイブレーション一覧がこちら。

これらのメソッドを使うだけでいい感じになる。

 public virtual void SelectionButton()
    {
        HapticPatterns.PlayPreset(HapticPatterns.PresetType.Selection);
    }

    public virtual void SuccessButton()
    {
        HapticPatterns.PlayPreset(HapticPatterns.PresetType.Success);
    }

    public virtual void WarningButton()
    {
        HapticPatterns.PlayPreset(HapticPatterns.PresetType.Warning);
    }

    public virtual void FailureButton()
    {
        HapticPatterns.PlayPreset(HapticPatterns.PresetType.Failure);
    }

    public virtual void RigidButton()
    {
        HapticPatterns.PlayPreset(HapticPatterns.PresetType.RigidImpact);
    }

    public virtual void SoftButton()
    {
        HapticPatterns.PlayPreset(HapticPatterns.PresetType.SoftImpact);
    }

    public virtual void LightButton()
    {
        HapticPatterns.PlayPreset(HapticPatterns.PresetType.LightImpact);
    }

    public virtual void MediumButton()
    {
        HapticPatterns.PlayPreset(HapticPatterns.PresetType.MediumImpact);
    }

    public virtual void HeavyButton()
    {
        HapticPatterns.PlayPreset(HapticPatterns.PresetType.HeavyImpact);
    }

UnityでNice Vibration(Feel)の機能を利用して、特定のアクションに対して簡単にバイブレーションを設定できます。この方法を使えば、iOSとAndroidの両方で同じバイブレーション効果を得ることができます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?