Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/BenoitFreslon/Vibration
Use custom vibrations on mobile with this native Plugin for Unity (Android & iOS)
https://github.com/BenoitFreslon/Vibration
Last synced: 3 months ago
JSON representation
Use custom vibrations on mobile with this native Plugin for Unity (Android & iOS)
- Host: GitHub
- URL: https://github.com/BenoitFreslon/Vibration
- Owner: BenoitFreslon
- License: apache-2.0
- Created: 2018-08-21T21:46:08.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-04-24T08:41:36.000Z (over 1 year ago)
- Last Synced: 2024-05-17T22:37:36.305Z (6 months ago)
- Language: C#
- Homepage:
- Size: 69.3 KB
- Stars: 383
- Watchers: 13
- Forks: 60
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vibration
Native **free** plugin for Unity for iOS and Android.
Use custom vibrations on mobile.If you like this free plugin, that's be cool if you can buy me a coffee 😀☕️
Send tips to https://paypal.me/UnityVibrationPlugin# Installation
The minimal checked Unity Version is 2019.3.* LTS
Open Package Manager and "Add package from git url..." using next string:
* `https://github.com/BenoitFreslon/Vibration.git`You also can edit `Packages/manifest.json` manually, just add:
* `"com.benoitfreslon.vibration": "https://github.com/BenoitFreslon/Vibration.git",`Or you can simply copy and paste the entire `Vibration` folder to your Unity3D `Assets` folder.
# Use
## Initialization
Initialize the plugin with this line before using vibrations:
`Vibration.Init();`
## Vibrations
### iOS and Android
#### Default vibration
Use `Vibration.Vibrate();` for a classic default ~400ms vibration
#### Pop vibration
Pop vibration: weak boom (For iOS: only available with the haptic engine. iPhone 6s minimum or Android)
`Vibration.VibratePop();`
#### Peek Vibration
Peek vibration: strong boom (For iOS: only available on iOS with the haptic engine. iPhone 6s minimum or Android)
`Vibration.VibratePeek();`
#### Nope Vibration
Nope vibration: series of three weak booms (For iOS: only available with the haptic engine. iPhone 6s minimum or Android)
`Vibration.VibrateNope();`
---
## Android Only#### Custom duration in milliseconds
`Vibration.Vibrate(500);`
#### Pattern
```
long [] pattern = { 0, 1000, 1000, 1000, 1000 };
Vibration.Vibrate ( pattern, -1 );
```#### Cancel
`Vibration.Cancel();`
---
## IOS only
vibration using haptic engine`Vibration.VibrateIOS(ImpactFeedbackStyle.Light);`
`Vibration.VibrateIOS(ImpactFeedbackStyle.Medium);`
`Vibration.VibrateIOS(ImpactFeedbackStyle.Heavy);`
`Vibration.VibrateIOS(ImpactFeedbackStyle.Rigid);`
`Vibration.VibrateIOS(ImpactFeedbackStyle.Soft);`
`Vibration.VibrateIOS(NotificationFeedbackStyle.Error);`
`Vibration.VibrateIOS(NotificationFeedbackStyle.Success);`
`Vibration.VibrateIOS(NotificationFeedbackStyle.Warning);`
`Vibration.VibrateIOS_SelectionChanged();`