From 8201822380d7e2acd24ec9d6e6190477dba164cb Mon Sep 17 00:00:00 2001 From: Benoit Freslon Date: Fri, 14 Aug 2020 00:49:59 +0200 Subject: [PATCH 01/20] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 1e21bd2..9b40581 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ Native plugin for Unity for iOS and Android. Use custom vibrations on mobile. +# Installation + +Copy the `Plugins` folder in your Unity3D `Assets` folder. + +# Use + **iOS and Android** * Use `Vibration.Vibrate();` for a classic default ~400ms vibration From b0bce1e4c8b651441d82aa883e91813ad81683b2 Mon Sep 17 00:00:00 2001 From: Benoit Freslon Date: Fri, 14 Aug 2020 01:12:38 +0200 Subject: [PATCH 02/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b40581..1bb5832 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Use custom vibrations on mobile. # Installation -Copy the `Plugins` folder in your Unity3D `Assets` folder. +Copy the entire `Vibration` folder in your Unity3D `Assets` folder. # Use From ab6c5ffc6731223da2ffc13a33f962a883fd8f1f Mon Sep 17 00:00:00 2001 From: Benoit Freslon Date: Fri, 14 Aug 2020 01:15:55 +0200 Subject: [PATCH 03/20] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1bb5832..28e7f2c 100644 --- a/README.md +++ b/README.md @@ -12,15 +12,15 @@ Copy the entire `Vibration` folder in your Unity3D `Assets` folder. * Use `Vibration.Vibrate();` for a classic default ~400ms vibration -* Pop vibration: weak boom (For iOS: only available with the haptic engine. iPhone 6s minimum) +* 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: 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: series of three weak booms (For iOS: only available with the haptic engine. iPhone 6s minimum or Android) `Vibration.VibrateNope();` From 3bfa33f35a0b8d8b444e05d116ad44ed7c903101 Mon Sep 17 00:00:00 2001 From: Benoit Freslon Date: Fri, 14 Aug 2020 10:31:16 +0200 Subject: [PATCH 04/20] Update README.md --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 28e7f2c..6003b6e 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,22 @@ # Vibration + Native plugin for Unity for iOS and Android. Use custom vibrations on mobile. # Installation -Copy the entire `Vibration` folder in your Unity3D `Assets` folder. +Copy and Postethe entire `Vibration` folder in your Unity3D `Assets` folder. # Use +## Initiatlisation + +Initialize the plugin with this line before using vibrations: + +`Vibration.Init();` + +## Vibrations + **iOS and Android** * Use `Vibration.Vibrate();` for a classic default ~400ms vibration From ce225388310f06776bafa786e185e8b6e0c90a48 Mon Sep 17 00:00:00 2001 From: Benoit Freslon Date: Fri, 14 Aug 2020 10:36:10 +0200 Subject: [PATCH 05/20] Update README.md --- README.md | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6003b6e..24d6423 100644 --- a/README.md +++ b/README.md @@ -17,37 +17,45 @@ Initialize the plugin with this line before using vibrations: ## Vibrations -**iOS and Android** +### 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 or Android) +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 or Android) +#### 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 or Android) +#### 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** +### 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();` From 691f7376444ffc54317f92aee2082b09d250c435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benoi=CC=82t=20Freslon?= Date: Fri, 14 Aug 2020 10:39:59 +0200 Subject: [PATCH 06/20] Update Android API 26 unitypackage Refactoring folders --- README.md | 2 +- Vibration.cs | 146 --------- Vibration.unitypackage | Bin 0 -> 11685 bytes Vibration/Example.meta | 8 + .../Example}/VibrationExample.cs | 15 +- .../Example}/VibrationExample.cs.meta | 0 .../Example}/VibrationExample.unity | 281 ++++++++++++++---- .../Example}/VibrationExample.unity.meta | 2 +- Vibration/Plugins.meta | 8 + {Plugins => Vibration/Plugins}/iOS.meta | 0 .../Plugins}/iOS/Vibration.meta | 0 .../Plugins}/iOS/Vibration/Vibration.h | 0 .../Plugins}/iOS/Vibration/Vibration.h.meta | 0 .../Plugins}/iOS/Vibration/Vibration.mm | 0 .../Plugins}/iOS/Vibration/Vibration.mm.meta | 0 Vibration/Vibration.cs | 222 ++++++++++++++ .../Vibration.cs.meta | 0 17 files changed, 474 insertions(+), 210 deletions(-) delete mode 100644 Vibration.cs create mode 100644 Vibration.unitypackage create mode 100644 Vibration/Example.meta rename {Example => Vibration/Example}/VibrationExample.cs (71%) rename {Example => Vibration/Example}/VibrationExample.cs.meta (100%) rename {Example => Vibration/Example}/VibrationExample.unity (90%) rename {Example => Vibration/Example}/VibrationExample.unity.meta (74%) create mode 100644 Vibration/Plugins.meta rename {Plugins => Vibration/Plugins}/iOS.meta (100%) rename {Plugins => Vibration/Plugins}/iOS/Vibration.meta (100%) rename {Plugins => Vibration/Plugins}/iOS/Vibration/Vibration.h (100%) rename {Plugins => Vibration/Plugins}/iOS/Vibration/Vibration.h.meta (100%) rename {Plugins => Vibration/Plugins}/iOS/Vibration/Vibration.mm (100%) rename {Plugins => Vibration/Plugins}/iOS/Vibration/Vibration.mm.meta (100%) create mode 100644 Vibration/Vibration.cs rename Vibration.cs.meta => Vibration/Vibration.cs.meta (100%) diff --git a/README.md b/README.md index 24d6423..8b67740 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Use custom vibrations on mobile. # Installation -Copy and Postethe entire `Vibration` folder in your Unity3D `Assets` folder. +Copy and Postethe entire `Vibration` folder in your Unity3D `Assets` folder or download and import the Vibration.unitypackage file. # Use diff --git a/Vibration.cs b/Vibration.cs deleted file mode 100644 index a04d40b..0000000 --- a/Vibration.cs +++ /dev/null @@ -1,146 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// @author Benoît Freslon @benoitfreslon -// https://github.com/BenoitFreslon/Vibration -// https://benoitfreslon.com -// -//////////////////////////////////////////////////////////////////////////////// - -using UnityEngine; -#if UNITY_IOS && !UNITY_EDITOR -using System.Collections; -using System.Runtime.InteropServices; -#endif - -public static class Vibration -{ -#if UNITY_IOS && !UNITY_EDITOR - [DllImport ( "__Internal" )] - private static extern bool _HasVibrator (); - - [DllImport ( "__Internal" )] - private static extern void _Vibrate (); - - [DllImport ( "__Internal" )] - private static extern void _VibratePop (); - - [DllImport ( "__Internal" )] - private static extern void _VibratePeek (); - - [DllImport ( "__Internal" )] - private static extern void _VibrateNope (); -#endif - - /// - /// Tiny pop vibration - /// - public static void VibratePop () - { - #if UNITY_IOS && !UNITY_EDITOR - _VibratePop (); - #elif UNITY_ANDROID && !UNITY_EDITOR - Vibrate(15); - #endif - } - /// - /// Small peek vibration - /// - public static void VibratePeek () - { - #if UNITY_IOS && !UNITY_EDITOR - _VibratePeek (); - #elif UNITY_ANDROID && !UNITY_EDITOR - Vibrate ( 25 ); - #endif - } - /// - /// 3 small vibrations - /// - public static void VibrateNope () - { - #if UNITY_IOS && !UNITY_EDITOR - _VibrateNope (); - #elif UNITY_ANDROID && !UNITY_EDITOR - long [] pattern = { 0, 5, 5, 5 }; - Vibrate( pattern, -1 ); - #endif - } - -#if UNITY_ANDROID && !UNITY_EDITOR - public static AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); - public static AndroidJavaObject currentActivity = unityPlayer.GetStatic("currentActivity"); - public static AndroidJavaObject vibrator =currentActivity.Call("getSystemService", "vibrator"); - public static AndroidJavaObject context = currentActivity.Call("getApplicationContext"); -#endif - /// - /// Only on Android - /// https://developer.android.com/reference/android/os/Vibrator.html#vibrate(long) - /// - public static void Vibrate(long milliseconds) - { -#if !UNITY_WEBGL - #if UNITY_ANDROID && !UNITY_EDITOR - vibrator.Call("vibrate", milliseconds); - #elif UNITY_IOS && !UNITY_EDITOR - Handheld.Vibrate(); - #else - Handheld.Vibrate(); - #endif -#endif - } - - /// - /// Only on Android - /// https://proandroiddev.com/using-vibrate-in-android-b0e3ef5d5e07 - /// - public static void Vibrate(long[] pattern, int repeat) - { -#if !UNITY_WEBGL - #if UNITY_ANDROID && !UNITY_EDITOR - vibrator.Call("vibrate", pattern, repeat); - #elif UNITY_IOS && !UNITY_EDITOR - Handheld.Vibrate(); - #else - Handheld.Vibrate(); - #endif -#endif - } - - /// - ///Only on Android - /// - public static void Cancel() - { - #if UNITY_ANDROID && !UNITY_EDITOR - vibrator.Call("cancel"); - #endif - } - - public static bool HasVibrator() - { -#if UNITY_ANDROID && !UNITY_EDITOR - AndroidJavaClass contextClass = new AndroidJavaClass("android.content.Context"); - string Context_VIBRATOR_SERVICE = contextClass.GetStatic("VIBRATOR_SERVICE"); - AndroidJavaObject systemService = context.Call("getSystemService", Context_VIBRATOR_SERVICE); - if (systemService.Call("hasVibrator")) - { - return true; - } - else - { - return false; - } -#elif UNITY_IOS && !UNITY_EDITOR - return _HasVibrator (); -#else - return false; -#endif - } - - public static void Vibrate() - { -#if !UNITY_WEBGL - Handheld.Vibrate(); -#endif - } -} diff --git a/Vibration.unitypackage b/Vibration.unitypackage new file mode 100644 index 0000000000000000000000000000000000000000..7a1c9258275b8d92467bc32a40bedcb61d58a0dd GIT binary patch literal 11685 zcmV;WEn3naiwFRCO*UTu1MPiVZ`??_*d#y@q=5i=%0qwvTo2ByjkQ|5U*w%VtD9|| zV_SkG&z^(D#)nN-OFU+ieb{V`G!y4{9=~hf zeK(!teg<6`pd^j*`EUR>95%GW#v%T0N$GEUj-wf>rXrYo&vb2Vpd)kOSb=BxIttMJ z5#;vkZ^QF${Z~<7{e8{VoWa1d01M2}3_RbqtsWuwv7K)HS5f-gfdTAR z^-VQ&hc2wYf$3fkhq^sPgV5C0LjQnx-TJSh^tXL?=s2b}R0DT7Fb4)2Ak_^m%~G|{ zaD9I*>u=bd{9j4wZ@UHv04GF4+x3U09_Sv@e8WYK=^)?n*0lbH)vf<3N`KoxNb^E# z;F-t`P1g!Nec-5$p(D$+{h_rU{;ziQzmfv{-?Wh*qR=s5QB2(&48Z#GkUsDb6x&-5 z{X3ohw~_+s=6NeZ+8Bl zm6Rpc-=9oS-XEddzvDMxK5WyRzy7*q()Bk?&9-et1?|s(^;aKsq;twMU;kkgqqk`` z^7EfiHi^b}@SFC^u-*J3vE!8s|r&ahl~Q+vzC^x`uxw zetbOmM-=3f9p%?=P&=KV?7+|c9R+?6{Mwr)VT?ZcBUG*X$ob+5RaSWPT3hzwZ8YWwm7q{r}PBzhN6d{}$-{ zs_mFMmj9+>bo9T9(jfmAAx7_Gnxu^L-`V&K5=J|NC zv%P&0<(JbzKS)R0djy8PQs^f#bg3EqQjdK6fk)GuPNL*OIlGzUX!Pb^mwxv5(>MlR z2OXQdnfs*w4kf?@g9^llDETK|^*M?1o5SQHN>EKz|MStCUT-`d#8I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rP{W| zUCySvRYO+Rt@pTZ>ARY1`QCev+cX|-kGr6r7AXlOr0n*%TeiootA=hno~mz@E0>LF zewu)$FlA&z6|u4)?IjA$v}dpaXpxW#MCh?a*sJYDZp z)s}Ut>aN`&S2TW=%;IEEVk$N$*;9FWn_*nFi4EYL_3`?60Ut(tcmYSI6>6c&vjYRP zMZW7=xLA4beJt5f;O2kND!q_7qgvxv@G`$H>#Wf2e88|5iKx z9KqWoZ^{_dWg&dL9g_{nLb(1r4(Wa^xqYaz4a4P6i?(6Pv^QrP=DTN5`rDr4Xa-OK zvMt9mU0WOI$Q(FU;90(o0<=8_sgl4n-uW9qHMVIg_;1Iy$lt0?f74<)ie@;PWtz|j zRZ%s^GVSja^#R8@w*XfA8FXcUk~GTa!vWZE*w79gi6Z`PNg-r2*`_fWAe*-jul>31U05Ado(9J0w literal 0 HcmV?d00001 diff --git a/Vibration/Example.meta b/Vibration/Example.meta new file mode 100644 index 0000000..8bce529 --- /dev/null +++ b/Vibration/Example.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a46eaded73024424bb1659e2b9eeee69 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Example/VibrationExample.cs b/Vibration/Example/VibrationExample.cs similarity index 71% rename from Example/VibrationExample.cs rename to Vibration/Example/VibrationExample.cs index a8994be..d49e702 100644 --- a/Example/VibrationExample.cs +++ b/Vibration/Example/VibrationExample.cs @@ -6,6 +6,7 @@ // //////////////////////////////////////////////////////////////////////////////// +using System; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -17,11 +18,14 @@ public class VibrationExample : MonoBehaviour public Text inputTime; public Text inputPattern; public Text inputRepeat; + public Text txtAndroidVersion; // Use this for initialization void Start () { - + Vibration.Init (); + Debug.Log ( "Application.isMobilePlatform: " + Application.isMobilePlatform ); + txtAndroidVersion.text = "Android Version: " + Vibration.AndroidVersion.ToString (); } // Update is called once per frame @@ -37,14 +41,17 @@ public void TapVibrate () public void TapVibrateCustom () { - Debug.Log ( inputTime.text ); Vibration.Vibrate ( int.Parse ( inputTime.text ) ); } public void TapVibratePattern () { - long[] longs = inputPattern.text.Select ( item => ( long )item ).ToArray (); - Debug.Log ( longs + " " + int.Parse ( inputRepeat.text ) ); + string[] patterns = inputPattern.text.Replace ( " ", "" ).Split ( ',' ); + long[] longs = Array.ConvertAll ( patterns, long.Parse ); + + Debug.Log ( longs.Length ); + //Vibration.Vibrate ( longs, int.Parse ( inputRepeat.text ) ); + Vibration.Vibrate ( longs, int.Parse ( inputRepeat.text ) ); } diff --git a/Example/VibrationExample.cs.meta b/Vibration/Example/VibrationExample.cs.meta similarity index 100% rename from Example/VibrationExample.cs.meta rename to Vibration/Example/VibrationExample.cs.meta diff --git a/Example/VibrationExample.unity b/Vibration/Example/VibrationExample.unity similarity index 90% rename from Example/VibrationExample.unity rename to Vibration/Example/VibrationExample.unity index 8d587b9..6321a0f 100644 --- a/Example/VibrationExample.unity +++ b/Vibration/Example/VibrationExample.unity @@ -54,7 +54,7 @@ LightmapSettings: m_EnableBakedLightmaps: 0 m_EnableRealtimeLightmaps: 0 m_LightmapEditorSettings: - serializedVersion: 10 + serializedVersion: 12 m_Resolution: 2 m_BakeResolution: 40 m_AtlasSize: 1024 @@ -62,6 +62,7 @@ LightmapSettings: m_AOMaxDistance: 1 m_CompAOExponent: 1 m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 m_Padding: 2 m_LightmapParameters: {fileID: 0} m_LightmapsBakeMode: 1 @@ -76,10 +77,16 @@ LightmapSettings: m_PVRDirectSampleCount: 32 m_PVRSampleCount: 500 m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 m_PVRFilterTypeDirect: 0 m_PVRFilterTypeIndirect: 0 m_PVRFilterTypeAO: 0 - m_PVRFilteringMode: 1 + m_PVREnvironmentMIS: 0 m_PVRCulling: 1 m_PVRFilteringGaussRadiusDirect: 1 m_PVRFilteringGaussRadiusIndirect: 5 @@ -87,7 +94,9 @@ LightmapSettings: m_PVRFilteringAtrousPositionSigmaDirect: 0.5 m_PVRFilteringAtrousPositionSigmaIndirect: 2 m_PVRFilteringAtrousPositionSigmaAO: 1 - m_ShowResolutionOverlay: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 m_LightingDataAsset: {fileID: 0} m_UseShadowmask: 1 --- !u!196 &4 @@ -158,12 +167,13 @@ MonoBehaviour: m_GameObject: {fileID: 7432646} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -224,7 +234,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 30} + m_SizeDelta: {x: 167.22774, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &152048751 MonoBehaviour: @@ -235,12 +245,13 @@ MonoBehaviour: m_GameObject: {fileID: 152048749} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -312,12 +323,13 @@ MonoBehaviour: m_GameObject: {fileID: 182228031} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -377,7 +389,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -51} + m_AnchoredPosition: {x: 0, y: -45} m_SizeDelta: {x: 0, y: 60} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &324698977 @@ -389,12 +401,13 @@ MonoBehaviour: m_GameObject: {fileID: 324698975} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -468,7 +481,7 @@ MonoBehaviour: m_GameObject: {fileID: 345238853} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: @@ -482,17 +495,20 @@ MonoBehaviour: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 345238856} @@ -519,12 +535,13 @@ MonoBehaviour: m_GameObject: {fileID: 345238853} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -537,6 +554,7 @@ MonoBehaviour: m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!222 &345238857 CanvasRenderer: m_ObjectHideFlags: 0 @@ -574,7 +592,7 @@ MonoBehaviour: m_GameObject: {fileID: 466977089} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} m_Name: m_EditorClassIdentifier: m_IgnoreReversedGraphics: 1 @@ -591,7 +609,7 @@ MonoBehaviour: m_GameObject: {fileID: 466977089} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} m_Name: m_EditorClassIdentifier: m_UiScaleMode: 1 @@ -663,6 +681,7 @@ MonoBehaviour: inputTime: {fileID: 951333923} inputPattern: {fileID: 1645088210} inputRepeat: {fileID: 1598618546} + txtAndroidVersion: {fileID: 858646535} --- !u!1 &568472776 GameObject: m_ObjectHideFlags: 0 @@ -709,12 +728,13 @@ MonoBehaviour: m_GameObject: {fileID: 568472776} m_Enabled: 0 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -788,7 +808,7 @@ MonoBehaviour: m_GameObject: {fileID: 617596107} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: @@ -802,17 +822,20 @@ MonoBehaviour: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 617596110} @@ -839,12 +862,13 @@ MonoBehaviour: m_GameObject: {fileID: 617596107} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -857,6 +881,7 @@ MonoBehaviour: m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!222 &617596111 CanvasRenderer: m_ObjectHideFlags: 0 @@ -914,7 +939,7 @@ MonoBehaviour: m_GameObject: {fileID: 622675457} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 575553740, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: @@ -928,17 +953,20 @@ MonoBehaviour: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 622675460} @@ -974,12 +1002,13 @@ MonoBehaviour: m_GameObject: {fileID: 622675457} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -992,6 +1021,7 @@ MonoBehaviour: m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!222 &622675461 CanvasRenderer: m_ObjectHideFlags: 0 @@ -1046,12 +1076,13 @@ MonoBehaviour: m_GameObject: {fileID: 646267801} m_Enabled: 0 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -1108,6 +1139,7 @@ RectTransform: - {fileID: 1764865174} - {fileID: 1508091270} - {fileID: 1670138780} + - {fileID: 858646537} m_Father: {fileID: 466977093} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1151,7 +1183,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 0} m_AnchoredPosition: {x: 0, y: -124} - m_SizeDelta: {x: 0, y: 30} + m_SizeDelta: {x: -40, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &775280440 MonoBehaviour: @@ -1162,12 +1194,13 @@ MonoBehaviour: m_GameObject: {fileID: 775280438} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -1175,7 +1208,7 @@ MonoBehaviour: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 25 m_FontStyle: 0 - m_BestFit: 0 + m_BestFit: 1 m_MinSize: 2 m_MaxSize: 40 m_Alignment: 4 @@ -1193,6 +1226,84 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 775280438} m_CullTransparentMesh: 0 +--- !u!1 &858646534 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 858646537} + - component: {fileID: 858646536} + - component: {fileID: 858646535} + m_Layer: 5 + m_Name: AndroidVersion + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &858646535 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 858646534} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 10 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 1 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Android Version +--- !u!222 &858646536 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 858646534} + m_CullTransparentMesh: 0 +--- !u!224 &858646537 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 858646534} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.99983996, y: 0.99983996, z: 0.99983996} + m_Children: [] + m_Father: {fileID: 705145219} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -212} + m_SizeDelta: {x: 0, y: 30} + m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &859354939 GameObject: m_ObjectHideFlags: 0 @@ -1231,7 +1342,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 30} + m_SizeDelta: {x: 60.7, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &859354941 MonoBehaviour: @@ -1242,7 +1353,7 @@ MonoBehaviour: m_GameObject: {fileID: 859354939} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} m_Name: m_EditorClassIdentifier: m_IgnoreLayout: 0 @@ -1262,7 +1373,7 @@ MonoBehaviour: m_GameObject: {fileID: 859354939} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: @@ -1276,17 +1387,20 @@ MonoBehaviour: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 859354943} @@ -1313,12 +1427,13 @@ MonoBehaviour: m_GameObject: {fileID: 859354939} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -1331,6 +1446,7 @@ MonoBehaviour: m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!222 &859354944 CanvasRenderer: m_ObjectHideFlags: 0 @@ -1385,12 +1501,13 @@ MonoBehaviour: m_GameObject: {fileID: 951333921} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -1454,7 +1571,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 30} + m_SizeDelta: {x: 73.92494, y: 29.997597} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &963626552 MonoBehaviour: @@ -1465,7 +1582,7 @@ MonoBehaviour: m_GameObject: {fileID: 963626550} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 575553740, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: @@ -1479,17 +1596,20 @@ MonoBehaviour: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 963626553} @@ -1525,12 +1645,13 @@ MonoBehaviour: m_GameObject: {fileID: 963626550} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -1543,6 +1664,7 @@ MonoBehaviour: m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!222 &963626554 CanvasRenderer: m_ObjectHideFlags: 0 @@ -1600,7 +1722,7 @@ MonoBehaviour: m_GameObject: {fileID: 1036050924} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 575553740, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: @@ -1614,17 +1736,20 @@ MonoBehaviour: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 1036050927} @@ -1660,12 +1785,13 @@ MonoBehaviour: m_GameObject: {fileID: 1036050924} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -1678,6 +1804,7 @@ MonoBehaviour: m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!222 &1036050928 CanvasRenderer: m_ObjectHideFlags: 0 @@ -1732,12 +1859,13 @@ MonoBehaviour: m_GameObject: {fileID: 1120240016} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -1811,7 +1939,7 @@ MonoBehaviour: m_GameObject: {fileID: 1120494233} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: @@ -1825,17 +1953,20 @@ MonoBehaviour: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 1120494236} @@ -1862,12 +1993,13 @@ MonoBehaviour: m_GameObject: {fileID: 1120494233} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -1880,6 +2012,7 @@ MonoBehaviour: m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!222 &1120494237 CanvasRenderer: m_ObjectHideFlags: 0 @@ -1934,12 +2067,13 @@ MonoBehaviour: m_GameObject: {fileID: 1330219602} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -2011,12 +2145,13 @@ MonoBehaviour: m_GameObject: {fileID: 1380144076} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -2088,12 +2223,13 @@ MonoBehaviour: m_GameObject: {fileID: 1422130449} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -2167,7 +2303,7 @@ MonoBehaviour: m_GameObject: {fileID: 1427728648} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: @@ -2181,17 +2317,20 @@ MonoBehaviour: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 1427728651} @@ -2218,12 +2357,13 @@ MonoBehaviour: m_GameObject: {fileID: 1427728648} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -2236,6 +2376,7 @@ MonoBehaviour: m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!222 &1427728652 CanvasRenderer: m_ObjectHideFlags: 0 @@ -2290,12 +2431,13 @@ MonoBehaviour: m_GameObject: {fileID: 1508091269} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -2367,12 +2509,13 @@ MonoBehaviour: m_GameObject: {fileID: 1548069566} m_Enabled: 0 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -2425,7 +2568,7 @@ MonoBehaviour: m_GameObject: {fileID: 1596789244} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} m_Name: m_EditorClassIdentifier: m_HorizontalAxis: Horizontal @@ -2444,7 +2587,7 @@ MonoBehaviour: m_GameObject: {fileID: 1596789244} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} m_Name: m_EditorClassIdentifier: m_FirstSelected: {fileID: 0} @@ -2491,12 +2634,13 @@ MonoBehaviour: m_GameObject: {fileID: 1598618545} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -2587,12 +2731,13 @@ MonoBehaviour: m_GameObject: {fileID: 1645088208} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -2666,7 +2811,7 @@ MonoBehaviour: m_GameObject: {fileID: 1670138779} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: -405508275, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} m_Name: m_EditorClassIdentifier: m_Padding: @@ -2678,8 +2823,10 @@ MonoBehaviour: m_Spacing: 10 m_ChildForceExpandWidth: 1 m_ChildForceExpandHeight: 1 - m_ChildControlWidth: 1 + m_ChildControlWidth: 0 m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 --- !u!1 &1679101617 GameObject: m_ObjectHideFlags: 0 @@ -2729,7 +2876,7 @@ MonoBehaviour: m_GameObject: {fileID: 1679101617} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} m_Name: m_EditorClassIdentifier: m_IgnoreLayout: 0 @@ -2749,7 +2896,7 @@ MonoBehaviour: m_GameObject: {fileID: 1679101617} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: @@ -2763,17 +2910,20 @@ MonoBehaviour: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 1679101621} @@ -2800,12 +2950,13 @@ MonoBehaviour: m_GameObject: {fileID: 1679101617} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -2818,6 +2969,7 @@ MonoBehaviour: m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!222 &1679101622 CanvasRenderer: m_ObjectHideFlags: 0 @@ -2873,7 +3025,7 @@ MonoBehaviour: m_GameObject: {fileID: 1764865173} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: -405508275, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} m_Name: m_EditorClassIdentifier: m_Padding: @@ -2887,6 +3039,8 @@ MonoBehaviour: m_ChildForceExpandHeight: 1 m_ChildControlWidth: 1 m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 --- !u!1 &1873484376 GameObject: m_ObjectHideFlags: 0 @@ -2934,9 +3088,10 @@ Camera: m_ClearFlags: 1 m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 m_SensorSize: {x: 36, y: 24} m_LensShift: {x: 0, y: 0} - m_GateFitMode: 2 m_FocalLength: 50 m_NormalizedViewPortRect: serializedVersion: 2 @@ -3026,7 +3181,7 @@ MonoBehaviour: m_GameObject: {fileID: 2010532244} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: @@ -3040,17 +3195,20 @@ MonoBehaviour: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 2010532247} @@ -3077,12 +3235,13 @@ MonoBehaviour: m_GameObject: {fileID: 2010532244} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -3095,6 +3254,7 @@ MonoBehaviour: m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!222 &2010532248 CanvasRenderer: m_ObjectHideFlags: 0 @@ -3150,7 +3310,7 @@ MonoBehaviour: m_GameObject: {fileID: 2015335721} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: -405508275, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} m_Name: m_EditorClassIdentifier: m_Padding: @@ -3164,6 +3324,8 @@ MonoBehaviour: m_ChildForceExpandHeight: 1 m_ChildControlWidth: 1 m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 --- !u!1 &2032679024 GameObject: m_ObjectHideFlags: 0 @@ -3249,7 +3411,7 @@ MonoBehaviour: m_GameObject: {fileID: 2050238278} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: -405508275, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} m_Name: m_EditorClassIdentifier: m_Padding: @@ -3263,6 +3425,8 @@ MonoBehaviour: m_ChildForceExpandHeight: 1 m_ChildControlWidth: 1 m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 --- !u!1 &2068006126 GameObject: m_ObjectHideFlags: 0 @@ -3309,12 +3473,13 @@ MonoBehaviour: m_GameObject: {fileID: 2068006126} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] diff --git a/Example/VibrationExample.unity.meta b/Vibration/Example/VibrationExample.unity.meta similarity index 74% rename from Example/VibrationExample.unity.meta rename to Vibration/Example/VibrationExample.unity.meta index 05e1f7d..6b2d625 100644 --- a/Example/VibrationExample.unity.meta +++ b/Vibration/Example/VibrationExample.unity.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1ca4fa42e3c3c4423998f38f6cdabc65 +guid: 97713010e65794861b2e4b75c95a2ece DefaultImporter: externalObjects: {} userData: diff --git a/Vibration/Plugins.meta b/Vibration/Plugins.meta new file mode 100644 index 0000000..ec312e3 --- /dev/null +++ b/Vibration/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8a18a006579744750bc5f62a817c99ae +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/iOS.meta b/Vibration/Plugins/iOS.meta similarity index 100% rename from Plugins/iOS.meta rename to Vibration/Plugins/iOS.meta diff --git a/Plugins/iOS/Vibration.meta b/Vibration/Plugins/iOS/Vibration.meta similarity index 100% rename from Plugins/iOS/Vibration.meta rename to Vibration/Plugins/iOS/Vibration.meta diff --git a/Plugins/iOS/Vibration/Vibration.h b/Vibration/Plugins/iOS/Vibration/Vibration.h similarity index 100% rename from Plugins/iOS/Vibration/Vibration.h rename to Vibration/Plugins/iOS/Vibration/Vibration.h diff --git a/Plugins/iOS/Vibration/Vibration.h.meta b/Vibration/Plugins/iOS/Vibration/Vibration.h.meta similarity index 100% rename from Plugins/iOS/Vibration/Vibration.h.meta rename to Vibration/Plugins/iOS/Vibration/Vibration.h.meta diff --git a/Plugins/iOS/Vibration/Vibration.mm b/Vibration/Plugins/iOS/Vibration/Vibration.mm similarity index 100% rename from Plugins/iOS/Vibration/Vibration.mm rename to Vibration/Plugins/iOS/Vibration/Vibration.mm diff --git a/Plugins/iOS/Vibration/Vibration.mm.meta b/Vibration/Plugins/iOS/Vibration/Vibration.mm.meta similarity index 100% rename from Plugins/iOS/Vibration/Vibration.mm.meta rename to Vibration/Plugins/iOS/Vibration/Vibration.mm.meta diff --git a/Vibration/Vibration.cs b/Vibration/Vibration.cs new file mode 100644 index 0000000..a34837b --- /dev/null +++ b/Vibration/Vibration.cs @@ -0,0 +1,222 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// @author Benoît Freslon @benoitfreslon +// https://github.com/BenoitFreslon/Vibration +// https://benoitfreslon.com +// +//////////////////////////////////////////////////////////////////////////////// + +using System.Runtime.InteropServices.ComTypes; +using UnityEngine; + +#if UNITY_IOS +using System.Collections; +using System.Runtime.InteropServices; +#endif + +public static class Vibration +{ + +#if UNITY_IOS + [DllImport ( "__Internal" )] + private static extern bool _HasVibrator (); + + [DllImport ( "__Internal" )] + private static extern void _Vibrate (); + + [DllImport ( "__Internal" )] + private static extern void _VibratePop (); + + [DllImport ( "__Internal" )] + private static extern void _VibratePeek (); + + [DllImport ( "__Internal" )] + private static extern void _VibrateNope (); +#endif + +#if UNITY_ANDROID + public static AndroidJavaClass unityPlayer; + public static AndroidJavaObject currentActivity; + public static AndroidJavaObject vibrator; + public static AndroidJavaObject context; + + public static AndroidJavaClass vibrationEffect; + + +#endif + + private static bool initialized = false; + public static void Init () + { + if ( initialized ) return; + +#if UNITY_ANDROID + + if ( Application.isMobilePlatform ) { + + unityPlayer = new AndroidJavaClass ( "com.unity3d.player.UnityPlayer" ); + currentActivity = unityPlayer.GetStatic ( "currentActivity" ); + vibrator = currentActivity.Call ( "getSystemService", "vibrator" ); + context = currentActivity.Call ( "getApplicationContext" ); + + if ( AndroidVersion >= 26 ) { + vibrationEffect = new AndroidJavaClass ( "android.os.VibrationEffect" ); + } + + } +#endif + + initialized = true; + } + + /// + /// Tiny pop vibration + /// + public static void VibratePop () + { + if ( Application.isMobilePlatform ) { +#if UNITY_IOS + _VibratePop (); +#elif UNITY_ANDROID + Vibrate ( 50 ); +#endif + } + } + /// + /// Small peek vibration + /// + public static void VibratePeek () + { + if ( Application.isMobilePlatform ) { +#if UNITY_IOS + _VibratePeek (); +#elif UNITY_ANDROID + Vibrate ( 100 ); +#endif + } + } + /// + /// 3 small vibrations + /// + public static void VibrateNope () + { + if ( Application.isMobilePlatform ) { +#if UNITY_IOS + _VibrateNope (); +#elif UNITY_ANDROID + long[] pattern = { 0, 50, 50, 50 }; + Vibrate ( pattern, -1 ); +#endif + } + } + + + /// + /// Only on Android + /// https://developer.android.com/reference/android/os/Vibrator.html#vibrate(long) + /// + public static void Vibrate ( long milliseconds ) + { + + if ( Application.isMobilePlatform ) { +#if !UNITY_WEBGL +#if UNITY_ANDROID + + if ( AndroidVersion >= 26 ) { + AndroidJavaObject createOneShot = vibrationEffect.CallStatic ( "createOneShot", milliseconds, -1 ); + vibrator.Call ( "vibrate", createOneShot ); + + } else { + vibrator.Call ( "vibrate", milliseconds ); + } +#elif UNITY_IOS + Handheld.Vibrate(); +#else + Handheld.Vibrate (); +#endif +#endif + } + } + + /// + /// Only on Android + /// https://proandroiddev.com/using-vibrate-in-android-b0e3ef5d5e07 + /// + public static void Vibrate ( long[] pattern, int repeat ) + { + if ( Application.isMobilePlatform ) { +#if UNITY_ANDROID + + if ( AndroidVersion >= 26 ) { + long[] amplitudes; + AndroidJavaObject createWaveform = vibrationEffect.CallStatic ( "createWaveform", pattern, repeat ); + vibrator.Call ( "vibrate", createWaveform ); + + } else { + vibrator.Call ( "vibrate", pattern, repeat ); + } +#elif UNITY_IOS + Handheld.Vibrate(); +#else + Handheld.Vibrate (); +#endif + } + } + + /// + ///Only on Android + /// + public static void Cancel () + { + if ( Application.isMobilePlatform ) { +#if UNITY_ANDROID + vibrator.Call ( "cancel" ); +#endif + } + } + + public static bool HasVibrator () + { + if ( Application.isMobilePlatform ) { + +#if UNITY_ANDROID + + AndroidJavaClass contextClass = new AndroidJavaClass ( "android.content.Context" ); + string Context_VIBRATOR_SERVICE = contextClass.GetStatic ( "VIBRATOR_SERVICE" ); + AndroidJavaObject systemService = context.Call ( "getSystemService", Context_VIBRATOR_SERVICE ); + if ( systemService.Call ( "hasVibrator" ) ) { + return true; + } else { + return false; + } + +#elif UNITY_IOS + return _HasVibrator (); +#else + return false; +#endif + } else { + return false; + } + } + + + public static void Vibrate () + { + if ( Application.isMobilePlatform ) { + Handheld.Vibrate (); + } + } + + public static int AndroidVersion { + get { + int iVersionNumber = 0; + if ( Application.platform == RuntimePlatform.Android ) { + string androidVersion = SystemInfo.operatingSystem; + int sdkPos = androidVersion.IndexOf ( "API-" ); + iVersionNumber = int.Parse ( androidVersion.Substring ( sdkPos + 4, 2 ).ToString () ); + } + return iVersionNumber; + } + } +} diff --git a/Vibration.cs.meta b/Vibration/Vibration.cs.meta similarity index 100% rename from Vibration.cs.meta rename to Vibration/Vibration.cs.meta From 030718a3dacc36fdf73fd988e17d6d3f9e7a6344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benoi=CC=82t=20Freslon?= Date: Sat, 15 Aug 2020 12:12:57 +0200 Subject: [PATCH 07/20] README updated --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b67740..a5bebbf 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Use custom vibrations on mobile. # Installation -Copy and Postethe entire `Vibration` folder in your Unity3D `Assets` folder or download and import the Vibration.unitypackage file. +Copy and paste the entire `Vibration` folder in your Unity3D `Assets` folder or download and import the `Vibration.unitypackage` file. # Use From eb8b8535678d01a3241b0d7096e8dacc2d2ed910 Mon Sep 17 00:00:00 2001 From: Benoit Freslon Date: Mon, 24 Jan 2022 11:29:51 +0100 Subject: [PATCH 08/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a5bebbf..7845a45 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Vibration -Native plugin for Unity for iOS and Android. +Native **free** plugin for Unity for iOS and Android. Use custom vibrations on mobile. # Installation From fabcfa0832933698d6f64a5ed318cce31d34c83f Mon Sep 17 00:00:00 2001 From: Benoit Freslon Date: Sat, 16 Apr 2022 11:46:40 +0200 Subject: [PATCH 09/20] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 7845a45..59837b0 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ 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 Copy and paste the entire `Vibration` folder in your Unity3D `Assets` folder or download and import the `Vibration.unitypackage` file. From a2d6608d8213a276b9b82fedc6fac67a9834dd1e Mon Sep 17 00:00:00 2001 From: Amin Date: Mon, 6 Feb 2023 19:34:01 +0300 Subject: [PATCH 10/20] added new haptic api --- README.md | 27 ++++++- Vibration.unitypackage | Bin 11685 -> 0 bytes Vibration/Example/VibrationExample.cs | 10 ++- .../Plugins/iOS/Vibration/HapticFeedback.mm | 64 ++++++++++++++++ Vibration/Vibration.cs | 72 +++++++++++++----- 5 files changed, 147 insertions(+), 26 deletions(-) delete mode 100644 Vibration.unitypackage create mode 100644 Vibration/Plugins/iOS/Vibration/HapticFeedback.mm diff --git a/README.md b/README.md index 59837b0..c456282 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,8 @@ Nope vibration: series of three weak booms (For iOS: only available with the hap `Vibration.VibrateNope();` - -### Android Only +--- +## Android Only #### Custom duration in milliseconds @@ -62,5 +62,28 @@ Vibration.Vibrate ( pattern, -1 ); `Vibration.Cancel();` +--- +## IOS only +vibration using haptic engine + +> 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();` +``` \ No newline at end of file diff --git a/Vibration.unitypackage b/Vibration.unitypackage deleted file mode 100644 index 7a1c9258275b8d92467bc32a40bedcb61d58a0dd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11685 zcmV;WEn3naiwFRCO*UTu1MPiVZ`??_*d#y@q=5i=%0qwvTo2ByjkQ|5U*w%VtD9|| zV_SkG&z^(D#)nN-OFU+ieb{V`G!y4{9=~hf zeK(!teg<6`pd^j*`EUR>95%GW#v%T0N$GEUj-wf>rXrYo&vb2Vpd)kOSb=BxIttMJ z5#;vkZ^QF${Z~<7{e8{VoWa1d01M2}3_RbqtsWuwv7K)HS5f-gfdTAR z^-VQ&hc2wYf$3fkhq^sPgV5C0LjQnx-TJSh^tXL?=s2b}R0DT7Fb4)2Ak_^m%~G|{ zaD9I*>u=bd{9j4wZ@UHv04GF4+x3U09_Sv@e8WYK=^)?n*0lbH)vf<3N`KoxN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dV zE+nTp^*50zh|td`X_lWd{yKMh6y=(`6ht7`&xHg~luJoaBruUm5JzKW9Qz3(lLXbn zO05R66<0?n4wZDMTtR1mq2fB|(q($VT}@i0MwyVApz8Yp8cQC2YyttsVJmsTcwl)W zd|1!aJ=3!t-J{J>s}Gtu@ug;|4UU7$rdbV&(#HqUWK0ilN|lESg}<0M^qf~62SGf=<6$G_4V{5yjZzTBR|q~& z2uf3>CuazZL*YVIbzMG{C`42%P9;{T`~jnzx3oEi#{->9yk#nrLNU@+O|=YtqmJ{7 zF*RIGEMOXx9s$#Ec2U60KfAb>14&Ilt*)v?tMUO9^U)R`K!KI5ih0mg+f`Lt)90t~ z*DS-Z99`e^n1_Nc+G68Zajx6r?)JF5J??Ig`*HTT%euvy_PB*wBEY&WZt-O97I(39 z&s?;1Tinlmi@UI*TC>GnrG^)Xi(6aU7I!h27MZsUrP{W| zUCySvRYO+Rt@pTZ>ARY1`QCev+cX|-kGr6r7AXlOr0n*%TeiootA=hno~mz@E0>LF zewu)$FlA&z6|u4)?IjA$v}dpaXpxW#MCh?a*sJYDZp z)s}Ut>aN`&S2TW=%;IEEVk$N$*;9FWn_*nFi4EYL_3`?60Ut(tcmYSI6>6c&vjYRP zMZW7=xLA4beJt5f;O2kND!q_7qgvxv@G`$H>#Wf2e88|5iKx z9KqWoZ^{_dWg&dL9g_{nLb(1r4(Wa^xqYaz4a4P6i?(6Pv^QrP=DTN5`rDr4Xa-OK zvMt9mU0WOI$Q(FU;90(o0<=8_sgl4n-uW9qHMVIg_;1Iy$lt0?f74<)ie@;PWtz|j zRZ%s^GVSja^#R8@w*XfA8FXcUk~GTa!vWZE*w79gi6Z`PNg-r2*`_fWAe*-jul>31U05Ado(9J0w diff --git a/Vibration/Example/VibrationExample.cs b/Vibration/Example/VibrationExample.cs index d49e702..bb18615 100644 --- a/Vibration/Example/VibrationExample.cs +++ b/Vibration/Example/VibrationExample.cs @@ -6,7 +6,7 @@ // //////////////////////////////////////////////////////////////////////////////// -using System; +using System; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -41,7 +41,9 @@ public void TapVibrate () public void TapVibrateCustom () { +#if UNITY_ANDROID Vibration.Vibrate ( int.Parse ( inputTime.text ) ); +#endif } public void TapVibratePattern () @@ -51,14 +53,16 @@ public void TapVibratePattern () Debug.Log ( longs.Length ); //Vibration.Vibrate ( longs, int.Parse ( inputRepeat.text ) ); - +#if UNITY_ANDROID Vibration.Vibrate ( longs, int.Parse ( inputRepeat.text ) ); +#endif } public void TapCancelVibrate () { - +#if UNITY_ANDROID Vibration.Cancel (); +#endif } public void TapPopVibrate () diff --git a/Vibration/Plugins/iOS/Vibration/HapticFeedback.mm b/Vibration/Plugins/iOS/Vibration/HapticFeedback.mm new file mode 100644 index 0000000..3a67ae2 --- /dev/null +++ b/Vibration/Plugins/iOS/Vibration/HapticFeedback.mm @@ -0,0 +1,64 @@ +#import + +extern "C" { + +void _impactOccurred(const char *style) +{ + + UIImpactFeedbackStyle feedbackStyle; + if (strcmp(style, "Heavy") == 0) + feedbackStyle = UIImpactFeedbackStyleHeavy; + else if (strcmp(style, "Medium") == 0) + feedbackStyle = UIImpactFeedbackStyleMedium; + else if (strcmp(style, "Light") == 0) + feedbackStyle = UIImpactFeedbackStyleLight; + else if (strcmp(style, "Rigid") == 0) + if (@available(iOS 13.0, *)) { + feedbackStyle = UIImpactFeedbackStyleRigid; + } else { + return; + } + else if (strcmp(style, "Soft") == 0) + if (@available(iOS 13.0, *)) { + feedbackStyle = UIImpactFeedbackStyleSoft; + } else { + return; + } + else + return; + + UIImpactFeedbackGenerator *generator = [[UIImpactFeedbackGenerator alloc] initWithStyle:feedbackStyle]; + + [generator prepare]; + + [generator impactOccurred]; +} + +void _notificationOccurred(const char *style) +{ + UINotificationFeedbackType feedbackStyle; + if (strcmp(style, "Error") == 0) + feedbackStyle = UINotificationFeedbackTypeError; + else if (strcmp(style, "Success") == 0) + feedbackStyle = UINotificationFeedbackTypeSuccess; + else if (strcmp(style, "Warning") == 0) + feedbackStyle = UINotificationFeedbackTypeWarning; + else + return; + + UINotificationFeedbackGenerator *generator = [[UINotificationFeedbackGenerator alloc] init]; + + [generator prepare]; + + [generator notificationOccurred:feedbackStyle]; +} + +void _selectionChanged() +{ + UISelectionFeedbackGenerator *generator = [[UISelectionFeedbackGenerator alloc] init]; + + [generator prepare]; + + [generator selectionChanged]; +} +} diff --git a/Vibration/Vibration.cs b/Vibration/Vibration.cs index a34837b..439af75 100644 --- a/Vibration/Vibration.cs +++ b/Vibration/Vibration.cs @@ -6,7 +6,7 @@ // //////////////////////////////////////////////////////////////////////////////// -using System.Runtime.InteropServices.ComTypes; +using System.Runtime.InteropServices.ComTypes; using UnityEngine; #if UNITY_IOS @@ -32,6 +32,15 @@ public static class Vibration [DllImport ( "__Internal" )] private static extern void _VibrateNope (); + + [DllImport("__Internal")] + private static extern void _impactOccurred(string style); + + [DllImport("__Internal")] + private static extern void _notificationOccurred(string style); + + [DllImport("__Internal")] + private static extern void _selectionChanged(); #endif #if UNITY_ANDROID @@ -69,6 +78,25 @@ public static void Init () initialized = true; } +#if UNITY_IOS + public static void VibrateIOS(ImpactFeedbackStyle style) + { + _impactOccurred(style.ToString()); + } + + public static void VibrateIOS(NotificationFeedbackStyle style) + { + _notificationOccurred(style.ToString()); + } + + public static void VibrateIOS_SelectionChanged() + { + _selectionChanged(); + } +#endif + + + /// /// Tiny pop vibration /// @@ -111,17 +139,15 @@ public static void VibrateNope () } +#if UNITY_ANDROID /// /// Only on Android /// https://developer.android.com/reference/android/os/Vibrator.html#vibrate(long) /// - public static void Vibrate ( long milliseconds ) + public static void VibrateAndroid ( long milliseconds ) { if ( Application.isMobilePlatform ) { -#if !UNITY_WEBGL -#if UNITY_ANDROID - if ( AndroidVersion >= 26 ) { AndroidJavaObject createOneShot = vibrationEffect.CallStatic ( "createOneShot", milliseconds, -1 ); vibrator.Call ( "vibrate", createOneShot ); @@ -129,12 +155,6 @@ public static void Vibrate ( long milliseconds ) } else { vibrator.Call ( "vibrate", milliseconds ); } -#elif UNITY_IOS - Handheld.Vibrate(); -#else - Handheld.Vibrate (); -#endif -#endif } } @@ -142,11 +162,9 @@ public static void Vibrate ( long milliseconds ) /// Only on Android /// https://proandroiddev.com/using-vibrate-in-android-b0e3ef5d5e07 /// - public static void Vibrate ( long[] pattern, int repeat ) + public static void VibrateAndroid ( long[] pattern, int repeat ) { if ( Application.isMobilePlatform ) { -#if UNITY_ANDROID - if ( AndroidVersion >= 26 ) { long[] amplitudes; AndroidJavaObject createWaveform = vibrationEffect.CallStatic ( "createWaveform", pattern, repeat ); @@ -155,18 +173,14 @@ public static void Vibrate ( long[] pattern, int repeat ) } else { vibrator.Call ( "vibrate", pattern, repeat ); } -#elif UNITY_IOS - Handheld.Vibrate(); -#else - Handheld.Vibrate (); -#endif } } - +#endif + /// ///Only on Android /// - public static void Cancel () + public static void CancelAndroid () { if ( Application.isMobilePlatform ) { #if UNITY_ANDROID @@ -220,3 +234,19 @@ public static int AndroidVersion { } } } + +public enum ImpactFeedbackStyle +{ + Heavy, + Medium, + Light, + Rigid, + Soft +} + +public enum NotificationFeedbackStyle +{ + Error, + Success, + Warning +} From a76b33519583825dbafff190cc5bd5e8996e6942 Mon Sep 17 00:00:00 2001 From: Amin Date: Mon, 6 Feb 2023 19:45:35 +0300 Subject: [PATCH 11/20] updated android apis --- Vibration/Example/VibrationExample.cs | 6 +++--- Vibration/Vibration.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Vibration/Example/VibrationExample.cs b/Vibration/Example/VibrationExample.cs index bb18615..bf5f1c4 100644 --- a/Vibration/Example/VibrationExample.cs +++ b/Vibration/Example/VibrationExample.cs @@ -42,7 +42,7 @@ public void TapVibrate () public void TapVibrateCustom () { #if UNITY_ANDROID - Vibration.Vibrate ( int.Parse ( inputTime.text ) ); + Vibration.VibrateAndroid ( int.Parse ( inputTime.text ) ); #endif } @@ -54,14 +54,14 @@ public void TapVibratePattern () Debug.Log ( longs.Length ); //Vibration.Vibrate ( longs, int.Parse ( inputRepeat.text ) ); #if UNITY_ANDROID - Vibration.Vibrate ( longs, int.Parse ( inputRepeat.text ) ); + Vibration.VibrateAndroid ( longs, int.Parse ( inputRepeat.text ) ); #endif } public void TapCancelVibrate () { #if UNITY_ANDROID - Vibration.Cancel (); + Vibration.CancelAndroid(); #endif } diff --git a/Vibration/Vibration.cs b/Vibration/Vibration.cs index 439af75..10b3989 100644 --- a/Vibration/Vibration.cs +++ b/Vibration/Vibration.cs @@ -106,7 +106,7 @@ public static void VibratePop () #if UNITY_IOS _VibratePop (); #elif UNITY_ANDROID - Vibrate ( 50 ); + VibrateAndroid ( 50 ); #endif } } @@ -119,7 +119,7 @@ public static void VibratePeek () #if UNITY_IOS _VibratePeek (); #elif UNITY_ANDROID - Vibrate ( 100 ); + VibrateAndroid ( 100 ); #endif } } @@ -133,7 +133,7 @@ public static void VibrateNope () _VibrateNope (); #elif UNITY_ANDROID long[] pattern = { 0, 50, 50, 50 }; - Vibrate ( pattern, -1 ); + VibrateAndroid ( pattern, -1 ); #endif } } From 3cc73945382c913b81b706cc6ba8930df6ec2528 Mon Sep 17 00:00:00 2001 From: Victor Nunes Date: Tue, 7 Mar 2023 17:49:53 -0300 Subject: [PATCH 12/20] #18 Fix build compilation at non mobile platforms --- Vibration/Vibration.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Vibration/Vibration.cs b/Vibration/Vibration.cs index 10b3989..0ad07ad 100644 --- a/Vibration/Vibration.cs +++ b/Vibration/Vibration.cs @@ -217,9 +217,13 @@ public static bool HasVibrator () public static void Vibrate () { +#if UNITY_ANDROID || UNITY_IOS + if ( Application.isMobilePlatform ) { Handheld.Vibrate (); } + +#endif } public static int AndroidVersion { From d734004f492e9abffbc56dc26460c483011950d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benoi=CC=82t=20Freslon?= Date: Sun, 19 Mar 2023 10:24:07 +0100 Subject: [PATCH 13/20] no message --- Vibration/Vibration.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Vibration/Vibration.cs b/Vibration/Vibration.cs index 0ad07ad..205f3b4 100644 --- a/Vibration/Vibration.cs +++ b/Vibration/Vibration.cs @@ -78,23 +78,27 @@ public static void Init () initialized = true; } -#if UNITY_IOS + public static void VibrateIOS(ImpactFeedbackStyle style) { +#if UNITY_IOS _impactOccurred(style.ToString()); +#endif } public static void VibrateIOS(NotificationFeedbackStyle style) { +#if UNITY_IOS _notificationOccurred(style.ToString()); +#endif } public static void VibrateIOS_SelectionChanged() { +#if UNITY_IOS _selectionChanged(); - } #endif - + } /// @@ -176,11 +180,11 @@ public static void VibrateAndroid ( long[] pattern, int repeat ) } } #endif - + /// ///Only on Android /// - public static void CancelAndroid () + public static void CancelAndroid() { if ( Application.isMobilePlatform ) { #if UNITY_ANDROID From 6d6837c47a5d40e56af91f0c83b2859b19a5e529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benoi=CC=82t=20Freslon?= Date: Sun, 19 Mar 2023 10:34:52 +0100 Subject: [PATCH 14/20] Revert "no message" This reverts commit d734004f492e9abffbc56dc26460c483011950d3. --- Vibration/Vibration.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Vibration/Vibration.cs b/Vibration/Vibration.cs index 205f3b4..0ad07ad 100644 --- a/Vibration/Vibration.cs +++ b/Vibration/Vibration.cs @@ -78,27 +78,23 @@ public static void Init () initialized = true; } - +#if UNITY_IOS public static void VibrateIOS(ImpactFeedbackStyle style) { -#if UNITY_IOS _impactOccurred(style.ToString()); -#endif } public static void VibrateIOS(NotificationFeedbackStyle style) { -#if UNITY_IOS _notificationOccurred(style.ToString()); -#endif } public static void VibrateIOS_SelectionChanged() { -#if UNITY_IOS _selectionChanged(); + } #endif - } + /// @@ -180,11 +176,11 @@ public static void VibrateAndroid ( long[] pattern, int repeat ) } } #endif - + /// ///Only on Android /// - public static void CancelAndroid() + public static void CancelAndroid () { if ( Application.isMobilePlatform ) { #if UNITY_ANDROID From 82502d25c88e1675cb01ab0ab82e15d5c5981b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benoi=CC=82t=20Freslon?= Date: Sun, 19 Mar 2023 10:36:07 +0100 Subject: [PATCH 15/20] Fix error using iOS Vibration methods --- Vibration/Vibration.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Vibration/Vibration.cs b/Vibration/Vibration.cs index 0ad07ad..d443eab 100644 --- a/Vibration/Vibration.cs +++ b/Vibration/Vibration.cs @@ -78,22 +78,29 @@ public static void Init () initialized = true; } -#if UNITY_IOS + public static void VibrateIOS(ImpactFeedbackStyle style) { +#if UNITY_IOS _impactOccurred(style.ToString()); +#endif } public static void VibrateIOS(NotificationFeedbackStyle style) { +#if UNITY_IOS _notificationOccurred(style.ToString()); +#endif } public static void VibrateIOS_SelectionChanged() + { +#if UNITY_IOS _selectionChanged(); - } #endif + } + From 5d52171474bd7e2f32fbd7d8a8b57761ad047d7c Mon Sep 17 00:00:00 2001 From: SH42913 Date: Fri, 21 Apr 2023 09:52:05 +0400 Subject: [PATCH 16/20] Fixed meta files --- Plugins.meta | 8 ---- Example.meta => Vibration.meta | 2 +- .../iOS/Vibration/HapticFeedback.mm.meta | 37 +++++++++++++++++++ 3 files changed, 38 insertions(+), 9 deletions(-) delete mode 100644 Plugins.meta rename Example.meta => Vibration.meta (77%) create mode 100644 Vibration/Plugins/iOS/Vibration/HapticFeedback.mm.meta diff --git a/Plugins.meta b/Plugins.meta deleted file mode 100644 index 43ce0b8..0000000 --- a/Plugins.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: de263cf6d06154de79925e3db600168f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Example.meta b/Vibration.meta similarity index 77% rename from Example.meta rename to Vibration.meta index d1b90af..5de7ef6 100644 --- a/Example.meta +++ b/Vibration.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f8faa38587bfb4cc3b4e1fa6631a2f67 +guid: af2a58662a093454d93166d4cc67760e folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Vibration/Plugins/iOS/Vibration/HapticFeedback.mm.meta b/Vibration/Plugins/iOS/Vibration/HapticFeedback.mm.meta new file mode 100644 index 0000000..0b97dde --- /dev/null +++ b/Vibration/Plugins/iOS/Vibration/HapticFeedback.mm.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: 077b20d7b7a7dc14aafdb8363888b849 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: From 66801cebedc08800da3b329282957e2533a99295 Mon Sep 17 00:00:00 2001 From: SH42913 Date: Fri, 21 Apr 2023 10:18:22 +0400 Subject: [PATCH 17/20] Vibration asmdef --- Vibration.asmdef | 3 +++ Vibration.asmdef.meta | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100644 Vibration.asmdef create mode 100644 Vibration.asmdef.meta diff --git a/Vibration.asmdef b/Vibration.asmdef new file mode 100644 index 0000000..fe8c30e --- /dev/null +++ b/Vibration.asmdef @@ -0,0 +1,3 @@ +{ + "name": "Vibration" +} diff --git a/Vibration.asmdef.meta b/Vibration.asmdef.meta new file mode 100644 index 0000000..32dc850 --- /dev/null +++ b/Vibration.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0c0c8357443d62a4c9e55fe39d3a3e51 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: From d69307859c610323c1d24322509335590f3a6e29 Mon Sep 17 00:00:00 2001 From: SH42913 Date: Fri, 21 Apr 2023 10:55:46 +0400 Subject: [PATCH 18/20] Unity package --- package.json | 13 +++++++++++++ package.json.meta | 7 +++++++ 2 files changed, 20 insertions(+) create mode 100644 package.json create mode 100644 package.json.meta diff --git a/package.json b/package.json new file mode 100644 index 0000000..26c6348 --- /dev/null +++ b/package.json @@ -0,0 +1,13 @@ +{ + "name": "com.benoitfreslon.vibration", + "author": "Benoit Freslon, AminSojoudi, SH42913", + "displayName": "Vibration", + "description": "Native free plugin for Unity for iOS and Android. Use custom vibrations on mobile.", + "unity": "2019.3", + "version": "2023.1.1", + "keywords": [], + "repository": { + "type": "git", + "url": "https://github.com/BenoitFreslon/Vibration" + } +} \ No newline at end of file diff --git a/package.json.meta b/package.json.meta new file mode 100644 index 0000000..98b9a2d --- /dev/null +++ b/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6ae7b7582587a39419e1454a19513673 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: From 9f65bde881dcd34edddb1ea220610ac555c5501a Mon Sep 17 00:00:00 2001 From: SH42913 Date: Fri, 21 Apr 2023 11:05:50 +0400 Subject: [PATCH 19/20] Updated README.md --- README.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c456282..3ee97e7 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,19 @@ Send tips to https://paypal.me/UnityVibrationPlugin # Installation -Copy and paste the entire `Vibration` folder in your Unity3D `Assets` folder or download and import the `Vibration.unitypackage` file. +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 -## Initiatlisation +## Initialization Initialize the plugin with this line before using vibrations: @@ -66,9 +74,6 @@ Vibration.Vibrate ( pattern, -1 ); ## IOS only vibration using haptic engine -> Haptic Engine - - `Vibration.VibrateIOS(ImpactFeedbackStyle.Light);` `Vibration.VibrateIOS(ImpactFeedbackStyle.Medium);` @@ -85,5 +90,4 @@ vibration using haptic engine `Vibration.VibrateIOS(NotificationFeedbackStyle.Warning);` -`Vibration.VibrateIOS_SelectionChanged();` -``` \ No newline at end of file +`Vibration.VibrateIOS_SelectionChanged();` \ No newline at end of file From 4ce3ff7f7bbdf2d3baefcfc1317b65a314ef122d Mon Sep 17 00:00:00 2001 From: SH42913 Date: Fri, 21 Apr 2023 11:09:02 +0400 Subject: [PATCH 20/20] Asmdef is available only for Android, iOS and Editor --- Vibration.asmdef | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Vibration.asmdef b/Vibration.asmdef index fe8c30e..ce8cd49 100644 --- a/Vibration.asmdef +++ b/Vibration.asmdef @@ -1,3 +1,18 @@ { - "name": "Vibration" -} + "name": "Vibration", + "rootNamespace": "", + "references": [], + "includePlatforms": [ + "Android", + "Editor", + "iOS" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file