forked from BenoitFreslon/Vibration
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Chore] Merged with forked upstream repo "[master]" branch
- Loading branch information
1 parent
39198d9
commit 49a398e
Showing
7 changed files
with
327 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,93 @@ | ||
# Vibration | ||
Native plugin for Unity for iOS and Android. | ||
|
||
Native **free** plugin for Unity for iOS and Android. | ||
Use custom vibrations on mobile. | ||
|
||
**iOS and Android** | ||
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 | ||
|
||
* Use `Vibration.Vibrate();` for a classic default ~400ms vibration | ||
#### Default vibration | ||
|
||
* Pop vibration: weak boom (For iOS: only available with the haptic engine. iPhone 6s minimum) | ||
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: strong boom (For iOS: only available on iOS with the haptic engine. iPhone 6s minimum) | ||
#### 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: series of three weak booms (For iOS: only available with the haptic engine. iPhone 6s minimum) | ||
#### Nope Vibration | ||
|
||
`Vibration.VibrateNope();` | ||
Nope vibration: series of three weak booms (For iOS: only available with the haptic engine. iPhone 6s minimum or Android) | ||
|
||
`Vibration.VibrateNope();` | ||
|
||
**Android Only** | ||
--- | ||
## Android Only | ||
|
||
* Custom duration in milliseconds | ||
#### Custom duration in milliseconds | ||
|
||
`Vibration.Vibrate(500);` | ||
|
||
* Pattern | ||
#### Pattern | ||
|
||
``` | ||
long [] pattern = { 0, 1000, 1000, 1000, 1000 }; | ||
Vibration.Vibrate ( pattern, -1 ); | ||
``` | ||
|
||
* Cancel | ||
#### 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();` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.