├── .gitignore ├── LICENSE ├── README.md └── UnityAndroidSensors ├── Data.meta ├── Data ├── Modifier.meta ├── Modifier │ ├── Acceleration Low Pass Modifier.asset │ └── Acceleration Low Pass Modifier.asset.meta ├── SmartData.meta └── SmartData │ ├── SmartEvents.meta │ ├── SmartEvents │ ├── OnLightOff.asset │ ├── OnLightOff.asset.meta │ ├── OnLightOn.asset │ ├── OnLightOn.asset.meta │ ├── OnShake.asset │ └── OnShake.asset.meta │ ├── SmartVars.meta │ └── SmartVars │ ├── Acceleration.asset │ ├── Acceleration.asset.meta │ ├── Gravity.asset │ ├── Gravity.asset.meta │ ├── Gyroscope.asset │ ├── Gyroscope.asset.meta │ ├── GyroscopeRAW.asset │ ├── GyroscopeRAW.asset.meta │ ├── Light.asset │ ├── Light.asset.meta │ ├── Rotation.asset │ ├── Rotation.asset.meta │ ├── StepCount.asset │ └── StepCount.asset.meta ├── Gizmos.meta ├── Gizmos ├── ComparisonIcon.png ├── ComparisonIcon.png.meta ├── EventVarIcon.png ├── EventVarIcon.png.meta ├── ListenerIcon.png ├── ListenerIcon.png.meta ├── ModifierIcon.png ├── ModifierIcon.png.meta ├── SmartVarIcon.png ├── SmartVarIcon.png.meta ├── sensorReaderIcon.png └── sensorReaderIcon.png.meta ├── Prefabs.meta ├── Prefabs ├── PRE_LightEventTriggerExample.prefab ├── PRE_LightEventTriggerExample.prefab.meta ├── PRE_UnitySensorPlugin.prefab ├── PRE_UnitySensorPlugin.prefab.meta ├── Sensors.meta └── Sensors │ ├── PRE_AccelerationSensor.prefab │ ├── PRE_AccelerationSensor.prefab.meta │ ├── PRE_GravitySensor.prefab │ ├── PRE_GravitySensor.prefab.meta │ ├── PRE_GyroscopeRAWSensor.prefab │ ├── PRE_GyroscopeRAWSensor.prefab.meta │ ├── PRE_GyroscopeSensor.prefab │ ├── PRE_GyroscopeSensor.prefab.meta │ ├── PRE_LightSensor.prefab │ ├── PRE_LightSensor.prefab.meta │ ├── PRE_RotationSensor.prefab │ ├── PRE_RotationSensor.prefab.meta │ ├── PRE_ShakeDetector.prefab │ ├── PRE_ShakeDetector.prefab.meta │ ├── PRE_Stepcount.prefab │ └── PRE_Stepcount.prefab.meta ├── Scripts.meta ├── Scripts ├── Core.meta ├── Core │ ├── Editor.meta │ ├── Editor │ │ ├── SensorReaderEditor.cs │ │ └── SensorReaderEditor.cs.meta │ ├── Sensor.cs │ ├── Sensor.cs.meta │ ├── SensorReader.cs │ ├── SensorReader.cs.meta │ ├── SensorReturnIndex.cs │ ├── SensorReturnIndex.cs.meta │ ├── UnitySensorPlugin.cs │ └── UnitySensorPlugin.cs.meta ├── Detectors.meta ├── Detectors │ ├── ShakeDetector.cs │ └── ShakeDetector.cs.meta ├── Modifier.meta ├── Modifier │ ├── AccelerationLowPassModifier.cs │ ├── AccelerationLowPassModifier.cs.meta │ ├── SensorValueModifier.cs │ └── SensorValueModifier.cs.meta ├── Utils.meta └── Utils │ ├── Comparator.meta │ ├── Comparator │ ├── FloatVarComparator.cs │ ├── FloatVarComparator.cs.meta │ ├── IntVarComparator.cs │ ├── IntVarComparator.cs.meta │ ├── SmartVarComparator.cs │ └── SmartVarComparator.cs.meta │ ├── Editor.meta │ ├── Editor │ ├── FloatVarComparatorEditor.cs │ ├── FloatVarComparatorEditor.cs.meta │ ├── IntVarComparatorEditor.cs │ ├── IntVarComparatorEditor.cs.meta │ ├── SmartVarComparatorEditor.cs │ └── SmartVarComparatorEditor.cs.meta │ ├── SmartEvents.meta │ ├── SmartEvents │ ├── Editor.meta │ ├── Editor │ │ ├── ListenSmartEventEditor.cs │ │ ├── ListenSmartEventEditor.cs.meta │ │ ├── SmartEventListenerDrawer.cs │ │ └── SmartEventListenerDrawer.cs.meta │ ├── ListenSmartEvent.cs │ ├── ListenSmartEvent.cs.meta │ ├── SmartEvent.cs │ ├── SmartEvent.cs.meta │ ├── SmartEventListener.cs │ └── SmartEventListener.cs.meta │ ├── SmartVars.meta │ └── SmartVars │ ├── FloatVar.cs │ ├── FloatVar.cs.meta │ ├── IntVar.cs │ ├── IntVar.cs.meta │ ├── SmartVar.cs │ ├── SmartVar.cs.meta │ ├── SmartVarType.cs │ ├── SmartVarType.cs.meta │ ├── Vector3Var.cs │ └── Vector3Var.cs.meta ├── UnitySensorPlugin.jar └── UnitySensorPlugin.jar.meta /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | [Bb]uilds/ 6 | [Jj]eTBrains/ 7 | Assets/AssetStoreTools* 8 | 9 | # Visual Studio cache directory 10 | /.vs/ 11 | 12 | # Autogenerated VS/MD/Consulo solution and project files 13 | ExportedObj/ 14 | .consulo/ 15 | *.csproj 16 | *.unityproj 17 | *.sln 18 | *.suo 19 | *.tmp 20 | *.user 21 | *.userprefs 22 | *.pidb 23 | *.booproj 24 | *.svd 25 | *.pdb 26 | 27 | # Unity3D generated meta files 28 | *.pidb.meta 29 | *.pdb.meta 30 | 31 | # Unity3D Generated File On Crash Reports 32 | sysinfo.txt 33 | 34 | # Builds 35 | *.apk 36 | *.unitypackage 37 | 38 | 39 | # Common IntelliJ Platform excludes 40 | 41 | # User specific 42 | **/.idea/**/workspace.xml 43 | **/.idea/**/tasks.xml 44 | **/.idea/shelf/* 45 | **/.idea/dictionaries 46 | 47 | # Sensitive or high-churn files 48 | **/.idea/**/dataSources/ 49 | **/.idea/**/dataSources.ids 50 | **/.idea/**/dataSources.xml 51 | **/.idea/**/dataSources.local.xml 52 | **/.idea/**/sqlDataSources.xml 53 | **/.idea/**/dynamic.xml 54 | 55 | # Rider 56 | # Rider auto-generates .iml files, and contentModel.xml 57 | **/.idea/**/*.iml 58 | **/.idea/**/contentModel.xml 59 | **/.idea/**/modules.xml 60 | 61 | **/.idea/**/indexLayout.xml 62 | **/.idea/**/vcs.xml 63 | **/JetBrains.meta 64 | 65 | 66 | [Bb]in/ 67 | _UpgradeReport_Files/ 68 | 69 | Thumbs.db 70 | Desktop.ini 71 | .DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Jar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android Sensors for Unity 2 | 3 | ## Overview 4 | 5 | Want to get the light sensor output or other cool stuff of your Android smartphone? This package provide you an easy access to the Android _Sensor Manager_. You can get a full list of possible sensors on this [page](https://developer.android.com/guide/topics/sensors/sensors_overview). Each output get stored in a smart variable. 6 | 7 | Inspired by the talk of Ryan Hipple's ([twitter](https://twitter.com/roboryantron) | [github](https://github.com/roboryantron)) amazing talk from Unite Austin 2017, you can find part of that in the unity [blog post](https://unity3d.com/how-to/architect-with-scriptable-objects), I wrote a simple event system based on _Scriptable Objects_. These system allows you to drag & drop variables and events around. 8 | ## Installation 9 | 10 | * Grab unityAndroidSensors.unitypackage from the Releases page for everything you need! 11 | * OR, use the git repository. 12 | * Tested with Unity 2018.3 (New Prefab Workflow) or above. 13 | 14 | ## What you get 15 | 16 | Firstly, You have access to every sensor value of the Android _Sensor Manager_. 17 | Secondly, You get a simple extentable event system which allows you to create _SmartEvents_ and _SmartVars_ in the project view. 18 | 19 | ## Events and Variables 20 | 21 | To create a new _SmartEvent_ or a _SmartVar_ you can use the _Create->SensorPlugin->SmartData_ context menu in the project view. 22 | 23 | Sensor Reader 24 | 25 | Events are accessible via the ListenSmartEvent Component 26 | 27 | Sensor Reader 28 | 29 | Here you can listen to _SmartEvent_'s. If a event gets fired all callbacks get invoked. 30 | 31 | These are particularly useful for game-level events, such as starting, pausing the game, a player dying etc. 32 | 33 | ## Variables 34 | 35 | Variables are just container of data, with the advantage that you can drag & drop them around like the events. 36 | 37 | ## Comparators 38 | 39 | Float- and IntVars can be compared by the _Float_- or _IntVarComparator_. You can choose to compare with a constant or another smart variable. 40 | 41 | Sensor Reader 42 | 43 | ### Unity Sensor Plugin 44 | 45 | The heart of the plugin is the _UnitySensorPlugin_ class. You need the class just once in your scene to get the connection to your Android phone. All sensor readers communicate with the _UnitySensorPlugin_ to get the sensor data as a float[3] array. 46 | 47 | ### Sensor Reader 48 | 49 | The *Sensor Reader* provides you with some option to choose the right sensor, the output type and the update interval (per frame). The output is stored in a _SmartVar_. This can be of type float, int or Vector3. 50 | 51 | If you choose int or float you have the option to select the specific axis of the output value, otherwise you get all axis as a _Vector3Var_. 52 | 53 | Sensor Reader 54 | 55 | ## Modifier 56 | 57 | If you want to modifiy the output of a sensor before it is written into a _SmartVar_ you can create a modifier which can manipulate the raw float[3] array from the sensor. 58 | 59 | An example of a modifier is in the Modifier folder. 60 | It is applied to the pre-configured acceleration sensor. 61 | 62 | ## New Unity Input System (Update 2019-10-15) 63 | Hey guys with the new input system the plugin is obsolet. https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/Sensors.html 64 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab6bc832f5ce14243b6387776b8ed90b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/Modifier.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 07176f3a14988e54c9a36920d1925183 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/Modifier/Acceleration Low Pass Modifier.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: dced765f95bc460e86beffbf44de3bfd, type: 3} 13 | m_Name: Acceleration Low Pass Modifier 14 | m_EditorClassIdentifier: 15 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/Modifier/Acceleration Low Pass Modifier.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 54e4a6160e9081c4484e421e0d0b5727 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d61c02345385d044a95026dbed92b96b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartEvents.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea5b689eb6ae7f141a9237cddebb5346 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartEvents/OnLightOff.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: ce468f54ae534b7f896dde3c787988f9, type: 3} 13 | m_Name: OnLightOff 14 | m_EditorClassIdentifier: 15 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartEvents/OnLightOff.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6443a480b2a416b4387b657c726c34e9 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartEvents/OnLightOn.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: ce468f54ae534b7f896dde3c787988f9, type: 3} 13 | m_Name: OnLightOn 14 | m_EditorClassIdentifier: 15 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartEvents/OnLightOn.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1cd13df13f057a049a62e6b1495aa914 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartEvents/OnShake.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: ce468f54ae534b7f896dde3c787988f9, type: 3} 13 | m_Name: OnShake 14 | m_EditorClassIdentifier: 15 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartEvents/OnShake.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f4b661da225116a4f91f8dc5006f57ef 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartVars.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 726db4fe9911ecc4cbfe881e10278138 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartVars/Acceleration.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: cd96a84ecd1c4749b01312c8cbcb7a06, type: 3} 13 | m_Name: Acceleration 14 | m_EditorClassIdentifier: 15 | value: {x: 0, y: 0, z: 0} 16 | defaultValue: {x: 0, y: 0, z: 0} 17 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartVars/Acceleration.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 46c81d3d55845ba43bb920881da07f13 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartVars/Gravity.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: cd96a84ecd1c4749b01312c8cbcb7a06, type: 3} 13 | m_Name: Gravity 14 | m_EditorClassIdentifier: 15 | value: {x: 0, y: 0, z: 0} 16 | defaultValue: {x: 0, y: 0, z: 0} 17 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartVars/Gravity.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a176c0b77ea5d1468e9b2aff120b023 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartVars/Gyroscope.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: cd96a84ecd1c4749b01312c8cbcb7a06, type: 3} 13 | m_Name: Gyroscope 14 | m_EditorClassIdentifier: 15 | value: {x: 0, y: 0, z: 0} 16 | defaultValue: {x: 0, y: 0, z: 0} 17 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartVars/Gyroscope.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0669f7dbcc9da5040977ccfbb6e36111 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartVars/GyroscopeRAW.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: cd96a84ecd1c4749b01312c8cbcb7a06, type: 3} 13 | m_Name: GyroscopeRAW 14 | m_EditorClassIdentifier: 15 | value: {x: 0, y: 0, z: 0} 16 | defaultValue: {x: 0, y: 0, z: 0} 17 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartVars/GyroscopeRAW.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 69f0f17183be70b4e9f432a482155bc3 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartVars/Light.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: e15af3a5f3874b94b3af2330f899078c, type: 3} 13 | m_Name: Light 14 | m_EditorClassIdentifier: 15 | defaultValue: 6 16 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartVars/Light.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cb4787d31f988ad43a0ef2a4e90779ad 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartVars/Rotation.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: cd96a84ecd1c4749b01312c8cbcb7a06, type: 3} 13 | m_Name: Rotation 14 | m_EditorClassIdentifier: 15 | value: {x: 0, y: 0, z: 0} 16 | defaultValue: {x: 0, y: 0, z: 0} 17 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartVars/Rotation.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02533e298ce09b44db731ad1c5e232d3 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartVars/StepCount.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 4e85a3ceeac3d7440bfec64569be43e4, type: 3} 13 | m_Name: StepCount 14 | m_EditorClassIdentifier: 15 | value: 0 16 | defaultValue: 0 17 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Data/SmartData/SmartVars/StepCount.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 63f2fdec2251ef0429d9a099b89da141 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Gizmos.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52961f80f4075824dbc657d6ead548fd 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Gizmos/ComparisonIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmeiburg/unityAndroidSensors/970653e236e93ee0dd30f226e49f0af4f02d3fc4/UnityAndroidSensors/Gizmos/ComparisonIcon.png -------------------------------------------------------------------------------- /UnityAndroidSensors/Gizmos/ComparisonIcon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f88c6fbd5f5330845ad821bf65b18fab 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 7 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | spriteSheet: 73 | serializedVersion: 2 74 | sprites: [] 75 | outline: [] 76 | physicsShape: [] 77 | bones: [] 78 | spriteID: 57dbbc12b1199c14c872d3d9e9ee16f5 79 | vertices: [] 80 | indices: 81 | edges: [] 82 | weights: [] 83 | spritePackingTag: 84 | pSDRemoveMatte: 0 85 | pSDShowRemoveMatteOption: 0 86 | userData: 87 | assetBundleName: 88 | assetBundleVariant: 89 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Gizmos/EventVarIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmeiburg/unityAndroidSensors/970653e236e93ee0dd30f226e49f0af4f02d3fc4/UnityAndroidSensors/Gizmos/EventVarIcon.png -------------------------------------------------------------------------------- /UnityAndroidSensors/Gizmos/EventVarIcon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b9304e071dd122d4696c7871b005c0f7 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 7 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | spriteSheet: 73 | serializedVersion: 2 74 | sprites: [] 75 | outline: [] 76 | physicsShape: [] 77 | bones: [] 78 | spriteID: 632e4b37e20a24e488f39dcd568c1de4 79 | vertices: [] 80 | indices: 81 | edges: [] 82 | weights: [] 83 | spritePackingTag: 84 | pSDRemoveMatte: 0 85 | pSDShowRemoveMatteOption: 0 86 | userData: 87 | assetBundleName: 88 | assetBundleVariant: 89 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Gizmos/ListenerIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmeiburg/unityAndroidSensors/970653e236e93ee0dd30f226e49f0af4f02d3fc4/UnityAndroidSensors/Gizmos/ListenerIcon.png -------------------------------------------------------------------------------- /UnityAndroidSensors/Gizmos/ListenerIcon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f696ce1ecca7e314daf708c50d1b883d 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 7 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | spriteSheet: 73 | serializedVersion: 2 74 | sprites: [] 75 | outline: [] 76 | physicsShape: [] 77 | bones: [] 78 | spriteID: 276beb9afa242024b92e5b8aaac512ab 79 | vertices: [] 80 | indices: 81 | edges: [] 82 | weights: [] 83 | spritePackingTag: 84 | pSDRemoveMatte: 0 85 | pSDShowRemoveMatteOption: 0 86 | userData: 87 | assetBundleName: 88 | assetBundleVariant: 89 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Gizmos/ModifierIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmeiburg/unityAndroidSensors/970653e236e93ee0dd30f226e49f0af4f02d3fc4/UnityAndroidSensors/Gizmos/ModifierIcon.png -------------------------------------------------------------------------------- /UnityAndroidSensors/Gizmos/ModifierIcon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ff2668573f30d64e85af86e2516ea9f 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 7 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | spriteSheet: 73 | serializedVersion: 2 74 | sprites: [] 75 | outline: [] 76 | physicsShape: [] 77 | bones: [] 78 | spriteID: 3dbde41dc7f3f0b4488c4f5073ccdfc1 79 | vertices: [] 80 | indices: 81 | edges: [] 82 | weights: [] 83 | spritePackingTag: 84 | pSDRemoveMatte: 0 85 | pSDShowRemoveMatteOption: 0 86 | userData: 87 | assetBundleName: 88 | assetBundleVariant: 89 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Gizmos/SmartVarIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmeiburg/unityAndroidSensors/970653e236e93ee0dd30f226e49f0af4f02d3fc4/UnityAndroidSensors/Gizmos/SmartVarIcon.png -------------------------------------------------------------------------------- /UnityAndroidSensors/Gizmos/SmartVarIcon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 46bcffe80499dd34b86c4a5f7ef57ca0 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 7 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | spriteSheet: 73 | serializedVersion: 2 74 | sprites: [] 75 | outline: [] 76 | physicsShape: [] 77 | bones: [] 78 | spriteID: fdcd5d1566fb73d4095334e78b2973ae 79 | vertices: [] 80 | indices: 81 | edges: [] 82 | weights: [] 83 | spritePackingTag: 84 | pSDRemoveMatte: 0 85 | pSDShowRemoveMatteOption: 0 86 | userData: 87 | assetBundleName: 88 | assetBundleVariant: 89 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Gizmos/sensorReaderIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmeiburg/unityAndroidSensors/970653e236e93ee0dd30f226e49f0af4f02d3fc4/UnityAndroidSensors/Gizmos/sensorReaderIcon.png -------------------------------------------------------------------------------- /UnityAndroidSensors/Gizmos/sensorReaderIcon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f66c379aa069ed54ab86852d43c29da4 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 7 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | spriteSheet: 73 | serializedVersion: 2 74 | sprites: [] 75 | outline: [] 76 | physicsShape: [] 77 | bones: [] 78 | spriteID: c7ba43e90b2ff5341878ba0c65ad599f 79 | vertices: [] 80 | indices: 81 | edges: [] 82 | weights: [] 83 | spritePackingTag: 84 | pSDRemoveMatte: 0 85 | pSDShowRemoveMatteOption: 0 86 | userData: 87 | assetBundleName: 88 | assetBundleVariant: 89 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a9751239b5306344892bd05780449f88 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/PRE_LightEventTriggerExample.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &5914830908363824273 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 5914830908363824274} 12 | - component: {fileID: 5914830908363824275} 13 | - component: {fileID: 5914830908363824272} 14 | m_Layer: 0 15 | m_Name: PRE_LightEventTrigger 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!4 &5914830908363824274 22 | Transform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 5914830908363824273} 28 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_Children: [] 32 | m_Father: {fileID: 0} 33 | m_RootOrder: 0 34 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 35 | --- !u!114 &5914830908363824275 36 | MonoBehaviour: 37 | m_ObjectHideFlags: 0 38 | m_CorrespondingSourceObject: {fileID: 0} 39 | m_PrefabInstance: {fileID: 0} 40 | m_PrefabAsset: {fileID: 0} 41 | m_GameObject: {fileID: 5914830908363824273} 42 | m_Enabled: 1 43 | m_EditorHideFlags: 0 44 | m_Script: {fileID: 11500000, guid: 0871dd0bbe0b4296a800833bfababfd5, type: 3} 45 | m_Name: 46 | m_EditorClassIdentifier: 47 | unityEvent: 48 | m_PersistentCalls: 49 | m_Calls: [] 50 | m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0, 51 | Culture=neutral, PublicKeyToken=null 52 | smartEvent: {fileID: 11400000, guid: 1cd13df13f057a049a62e6b1495aa914, type: 2} 53 | eventChoiceType: 0 54 | condition: 1 55 | useConst: 1 56 | constant: 5 57 | var1: {fileID: 11400000, guid: cb4787d31f988ad43a0ef2a4e90779ad, type: 2} 58 | var2: {fileID: 0} 59 | --- !u!114 &5914830908363824272 60 | MonoBehaviour: 61 | m_ObjectHideFlags: 0 62 | m_CorrespondingSourceObject: {fileID: 0} 63 | m_PrefabInstance: {fileID: 0} 64 | m_PrefabAsset: {fileID: 0} 65 | m_GameObject: {fileID: 5914830908363824273} 66 | m_Enabled: 1 67 | m_EditorHideFlags: 0 68 | m_Script: {fileID: 11500000, guid: 0871dd0bbe0b4296a800833bfababfd5, type: 3} 69 | m_Name: 70 | m_EditorClassIdentifier: 71 | unityEvent: 72 | m_PersistentCalls: 73 | m_Calls: [] 74 | m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0, 75 | Culture=neutral, PublicKeyToken=null 76 | smartEvent: {fileID: 11400000, guid: 6443a480b2a416b4387b657c726c34e9, type: 2} 77 | eventChoiceType: 0 78 | condition: 0 79 | useConst: 1 80 | constant: 0 81 | var1: {fileID: 11400000, guid: cb4787d31f988ad43a0ef2a4e90779ad, type: 2} 82 | var2: {fileID: 0} 83 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/PRE_LightEventTriggerExample.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 09d6b331b2f66964b82c5ab1d0c861ed 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/PRE_UnitySensorPlugin.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &533083372065539295 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 533083372065539294} 12 | - component: {fileID: 533083372065539289} 13 | m_Layer: 0 14 | m_Name: PRE_UnitySensorPlugin 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!4 &533083372065539294 21 | Transform: 22 | m_ObjectHideFlags: 0 23 | m_CorrespondingSourceObject: {fileID: 0} 24 | m_PrefabInstance: {fileID: 0} 25 | m_PrefabAsset: {fileID: 0} 26 | m_GameObject: {fileID: 533083372065539295} 27 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 28 | m_LocalPosition: {x: 0, y: 0, z: 0} 29 | m_LocalScale: {x: 1, y: 1, z: 1} 30 | m_Children: [] 31 | m_Father: {fileID: 0} 32 | m_RootOrder: 0 33 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 34 | --- !u!114 &533083372065539289 35 | MonoBehaviour: 36 | m_ObjectHideFlags: 0 37 | m_CorrespondingSourceObject: {fileID: 0} 38 | m_PrefabInstance: {fileID: 0} 39 | m_PrefabAsset: {fileID: 0} 40 | m_GameObject: {fileID: 533083372065539295} 41 | m_Enabled: 1 42 | m_EditorHideFlags: 0 43 | m_Script: {fileID: 11500000, guid: 9f1bb6f7f93e478f8a566b4fa6660e03, type: 3} 44 | m_Name: 45 | m_EditorClassIdentifier: 46 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/PRE_UnitySensorPlugin.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 942dafe75fb1e834c8afc696b3636614 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/Sensors.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b805b4ae701eb184c932641ab955473a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/Sensors/PRE_AccelerationSensor.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &2944621694652065007 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 235344838259647849} 12 | - component: {fileID: 2414161769561783114} 13 | m_Layer: 0 14 | m_Name: PRE_AccelerationSensor 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!4 &235344838259647849 21 | Transform: 22 | m_ObjectHideFlags: 0 23 | m_CorrespondingSourceObject: {fileID: 0} 24 | m_PrefabInstance: {fileID: 0} 25 | m_PrefabAsset: {fileID: 0} 26 | m_GameObject: {fileID: 2944621694652065007} 27 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 28 | m_LocalPosition: {x: 0, y: 0, z: 0} 29 | m_LocalScale: {x: 1, y: 1, z: 1} 30 | m_Children: [] 31 | m_Father: {fileID: 0} 32 | m_RootOrder: 0 33 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 34 | --- !u!114 &2414161769561783114 35 | MonoBehaviour: 36 | m_ObjectHideFlags: 0 37 | m_CorrespondingSourceObject: {fileID: 0} 38 | m_PrefabInstance: {fileID: 0} 39 | m_PrefabAsset: {fileID: 0} 40 | m_GameObject: {fileID: 2944621694652065007} 41 | m_Enabled: 1 42 | m_EditorHideFlags: 0 43 | m_Script: {fileID: 11500000, guid: cb9c681ce8b741b4bd99b9830a29b769, type: 3} 44 | m_Name: 45 | m_EditorClassIdentifier: 46 | sensor: 0 47 | updateInterval: 3 48 | returnType: 0 49 | sensorOutputNumber: 0 50 | vector3Value: {fileID: 11400000, guid: 46c81d3d55845ba43bb920881da07f13, type: 2} 51 | intValue: {fileID: 0} 52 | floatValue: {fileID: 0} 53 | modifiers: 54 | - {fileID: 11400000, guid: 54e4a6160e9081c4484e421e0d0b5727, type: 2} 55 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/Sensors/PRE_AccelerationSensor.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c719135068a9fd94e809d70c191b6f31 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/Sensors/PRE_GravitySensor.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &7722637420819170899 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 2539181068191431173} 12 | - component: {fileID: 5660485941877440372} 13 | m_Layer: 0 14 | m_Name: PRE_GravitySensor 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!4 &2539181068191431173 21 | Transform: 22 | m_ObjectHideFlags: 0 23 | m_CorrespondingSourceObject: {fileID: 0} 24 | m_PrefabInstance: {fileID: 0} 25 | m_PrefabAsset: {fileID: 0} 26 | m_GameObject: {fileID: 7722637420819170899} 27 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 28 | m_LocalPosition: {x: 0, y: 0, z: 0} 29 | m_LocalScale: {x: 1, y: 1, z: 1} 30 | m_Children: [] 31 | m_Father: {fileID: 0} 32 | m_RootOrder: 0 33 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 34 | --- !u!114 &5660485941877440372 35 | MonoBehaviour: 36 | m_ObjectHideFlags: 0 37 | m_CorrespondingSourceObject: {fileID: 0} 38 | m_PrefabInstance: {fileID: 0} 39 | m_PrefabAsset: {fileID: 0} 40 | m_GameObject: {fileID: 7722637420819170899} 41 | m_Enabled: 1 42 | m_EditorHideFlags: 0 43 | m_Script: {fileID: 11500000, guid: cb9c681ce8b741b4bd99b9830a29b769, type: 3} 44 | m_Name: 45 | m_EditorClassIdentifier: 46 | sensor: 4 47 | updateInterval: 3 48 | returnType: 0 49 | sensorOutputNumber: 0 50 | vector3Value: {fileID: 11400000, guid: 5a176c0b77ea5d1468e9b2aff120b023, type: 2} 51 | intValue: {fileID: 0} 52 | floatValue: {fileID: 0} 53 | modifiers: [] 54 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/Sensors/PRE_GravitySensor.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3f6805b0183c63b46b2323754da3b191 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/Sensors/PRE_GyroscopeRAWSensor.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &1893357552339318663 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 1893357552339318660} 12 | - component: {fileID: 1113509747040238495} 13 | m_Layer: 0 14 | m_Name: PRE_GyroscopeRAWSensor 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!4 &1893357552339318660 21 | Transform: 22 | m_ObjectHideFlags: 0 23 | m_CorrespondingSourceObject: {fileID: 0} 24 | m_PrefabInstance: {fileID: 0} 25 | m_PrefabAsset: {fileID: 0} 26 | m_GameObject: {fileID: 1893357552339318663} 27 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 28 | m_LocalPosition: {x: 0, y: 0, z: 0} 29 | m_LocalScale: {x: 1, y: 1, z: 1} 30 | m_Children: [] 31 | m_Father: {fileID: 0} 32 | m_RootOrder: 0 33 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 34 | --- !u!114 &1113509747040238495 35 | MonoBehaviour: 36 | m_ObjectHideFlags: 0 37 | m_CorrespondingSourceObject: {fileID: 0} 38 | m_PrefabInstance: {fileID: 0} 39 | m_PrefabAsset: {fileID: 0} 40 | m_GameObject: {fileID: 1893357552339318663} 41 | m_Enabled: 1 42 | m_EditorHideFlags: 0 43 | m_Script: {fileID: 11500000, guid: cb9c681ce8b741b4bd99b9830a29b769, type: 3} 44 | m_Name: 45 | m_EditorClassIdentifier: 46 | sensor: 6 47 | updateInterval: 3 48 | returnType: 0 49 | sensorOutputNumber: 0 50 | vector3Value: {fileID: 11400000, guid: 69f0f17183be70b4e9f432a482155bc3, type: 2} 51 | intValue: {fileID: 0} 52 | floatValue: {fileID: 0} 53 | modifiers: [] 54 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/Sensors/PRE_GyroscopeRAWSensor.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9bdd12b7d38b5948a06083333b58cbc 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/Sensors/PRE_GyroscopeSensor.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &1893357552339318663 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 1893357552339318660} 12 | - component: {fileID: 2091199430803525543} 13 | m_Layer: 0 14 | m_Name: PRE_GyroscopeSensor 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!4 &1893357552339318660 21 | Transform: 22 | m_ObjectHideFlags: 0 23 | m_CorrespondingSourceObject: {fileID: 0} 24 | m_PrefabInstance: {fileID: 0} 25 | m_PrefabAsset: {fileID: 0} 26 | m_GameObject: {fileID: 1893357552339318663} 27 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 28 | m_LocalPosition: {x: 0, y: 0, z: 0} 29 | m_LocalScale: {x: 1, y: 1, z: 1} 30 | m_Children: [] 31 | m_Father: {fileID: 0} 32 | m_RootOrder: 0 33 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 34 | --- !u!114 &2091199430803525543 35 | MonoBehaviour: 36 | m_ObjectHideFlags: 0 37 | m_CorrespondingSourceObject: {fileID: 0} 38 | m_PrefabInstance: {fileID: 0} 39 | m_PrefabAsset: {fileID: 0} 40 | m_GameObject: {fileID: 1893357552339318663} 41 | m_Enabled: 1 42 | m_EditorHideFlags: 0 43 | m_Script: {fileID: 11500000, guid: cb9c681ce8b741b4bd99b9830a29b769, type: 3} 44 | m_Name: 45 | m_EditorClassIdentifier: 46 | sensor: 5 47 | updateInterval: 3 48 | returnType: 0 49 | sensorOutputNumber: 0 50 | vector3Value: {fileID: 11400000, guid: 0669f7dbcc9da5040977ccfbb6e36111, type: 2} 51 | intValue: {fileID: 0} 52 | floatValue: {fileID: 0} 53 | modifiers: [] 54 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/Sensors/PRE_GyroscopeSensor.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 47fa7edd915c9314fb4ec5ed3e312672 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/Sensors/PRE_LightSensor.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &5041869993249540414 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 1002324011238405480} 12 | - component: {fileID: 939276022793599957} 13 | m_Layer: 0 14 | m_Name: PRE_LightSensor 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!4 &1002324011238405480 21 | Transform: 22 | m_ObjectHideFlags: 0 23 | m_CorrespondingSourceObject: {fileID: 0} 24 | m_PrefabInstance: {fileID: 0} 25 | m_PrefabAsset: {fileID: 0} 26 | m_GameObject: {fileID: 5041869993249540414} 27 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 28 | m_LocalPosition: {x: 0, y: 0, z: 0} 29 | m_LocalScale: {x: 1, y: 1, z: 1} 30 | m_Children: [] 31 | m_Father: {fileID: 0} 32 | m_RootOrder: 0 33 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 34 | --- !u!114 &939276022793599957 35 | MonoBehaviour: 36 | m_ObjectHideFlags: 0 37 | m_CorrespondingSourceObject: {fileID: 0} 38 | m_PrefabInstance: {fileID: 0} 39 | m_PrefabAsset: {fileID: 0} 40 | m_GameObject: {fileID: 5041869993249540414} 41 | m_Enabled: 1 42 | m_EditorHideFlags: 0 43 | m_Script: {fileID: 11500000, guid: cb9c681ce8b741b4bd99b9830a29b769, type: 3} 44 | m_Name: 45 | m_EditorClassIdentifier: 46 | sensor: 8 47 | updateInterval: 3 48 | returnType: 2 49 | sensorOutputNumber: 0 50 | vector3Value: {fileID: 0} 51 | intValue: {fileID: 0} 52 | floatValue: {fileID: 11400000, guid: cb4787d31f988ad43a0ef2a4e90779ad, type: 2} 53 | modifiers: [] 54 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/Sensors/PRE_LightSensor.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 954d8ab8a23cb2247b6b03aa1288a4ae 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/Sensors/PRE_RotationSensor.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &6968946974865031305 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 7001849764955587906} 12 | - component: {fileID: 4997247484937017314} 13 | m_Layer: 0 14 | m_Name: PRE_RotationSensor 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!4 &7001849764955587906 21 | Transform: 22 | m_ObjectHideFlags: 0 23 | m_CorrespondingSourceObject: {fileID: 0} 24 | m_PrefabInstance: {fileID: 0} 25 | m_PrefabAsset: {fileID: 0} 26 | m_GameObject: {fileID: 6968946974865031305} 27 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 28 | m_LocalPosition: {x: 0, y: 0, z: 0} 29 | m_LocalScale: {x: 1, y: 1, z: 1} 30 | m_Children: [] 31 | m_Father: {fileID: 0} 32 | m_RootOrder: 0 33 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 34 | --- !u!114 &4997247484937017314 35 | MonoBehaviour: 36 | m_ObjectHideFlags: 0 37 | m_CorrespondingSourceObject: {fileID: 0} 38 | m_PrefabInstance: {fileID: 0} 39 | m_PrefabAsset: {fileID: 0} 40 | m_GameObject: {fileID: 6968946974865031305} 41 | m_Enabled: 1 42 | m_EditorHideFlags: 0 43 | m_Script: {fileID: 11500000, guid: cb9c681ce8b741b4bd99b9830a29b769, type: 3} 44 | m_Name: 45 | m_EditorClassIdentifier: 46 | sensor: 15 47 | updateInterval: 3 48 | returnType: 0 49 | sensorOutputNumber: 0 50 | vector3Value: {fileID: 11400000, guid: 02533e298ce09b44db731ad1c5e232d3, type: 2} 51 | intValue: {fileID: 0} 52 | floatValue: {fileID: 0} 53 | modifiers: [] 54 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/Sensors/PRE_RotationSensor.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e1e21d3730ab7d54b83681ef9fcd6faf 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/Sensors/PRE_ShakeDetector.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &5041869993249540414 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 1002324011238405480} 12 | - component: {fileID: 4491197296310221910} 13 | m_Layer: 0 14 | m_Name: PRE_ShakeDetector 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!4 &1002324011238405480 21 | Transform: 22 | m_ObjectHideFlags: 0 23 | m_CorrespondingSourceObject: {fileID: 0} 24 | m_PrefabInstance: {fileID: 0} 25 | m_PrefabAsset: {fileID: 0} 26 | m_GameObject: {fileID: 5041869993249540414} 27 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 28 | m_LocalPosition: {x: 0, y: 0, z: 0} 29 | m_LocalScale: {x: 1, y: 1, z: 1} 30 | m_Children: [] 31 | m_Father: {fileID: 0} 32 | m_RootOrder: 0 33 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 34 | --- !u!114 &4491197296310221910 35 | MonoBehaviour: 36 | m_ObjectHideFlags: 0 37 | m_CorrespondingSourceObject: {fileID: 0} 38 | m_PrefabInstance: {fileID: 0} 39 | m_PrefabAsset: {fileID: 0} 40 | m_GameObject: {fileID: 5041869993249540414} 41 | m_Enabled: 1 42 | m_EditorHideFlags: 0 43 | m_Script: {fileID: 11500000, guid: b4d00824c94a43229a348b6f86f098c0, type: 3} 44 | m_Name: 45 | m_EditorClassIdentifier: 46 | acceleration: {fileID: 11400000, guid: 46c81d3d55845ba43bb920881da07f13, type: 2} 47 | onShakeEvent: {fileID: 11400000, guid: f4b661da225116a4f91f8dc5006f57ef, type: 2} 48 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/Sensors/PRE_ShakeDetector.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 950565e693c55924f8b93b470a9b3b09 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/Sensors/PRE_Stepcount.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &5041869993249540414 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 1002324011238405480} 12 | - component: {fileID: 6231369062381585951} 13 | m_Layer: 0 14 | m_Name: PRE_Stepcount 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!4 &1002324011238405480 21 | Transform: 22 | m_ObjectHideFlags: 0 23 | m_CorrespondingSourceObject: {fileID: 0} 24 | m_PrefabInstance: {fileID: 0} 25 | m_PrefabAsset: {fileID: 0} 26 | m_GameObject: {fileID: 5041869993249540414} 27 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 28 | m_LocalPosition: {x: 0, y: 0, z: 0} 29 | m_LocalScale: {x: 1, y: 1, z: 1} 30 | m_Children: [] 31 | m_Father: {fileID: 0} 32 | m_RootOrder: 0 33 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 34 | --- !u!114 &6231369062381585951 35 | MonoBehaviour: 36 | m_ObjectHideFlags: 0 37 | m_CorrespondingSourceObject: {fileID: 0} 38 | m_PrefabInstance: {fileID: 0} 39 | m_PrefabAsset: {fileID: 0} 40 | m_GameObject: {fileID: 5041869993249540414} 41 | m_Enabled: 1 42 | m_EditorHideFlags: 0 43 | m_Script: {fileID: 11500000, guid: cb9c681ce8b741b4bd99b9830a29b769, type: 3} 44 | m_Name: 45 | m_EditorClassIdentifier: 46 | sensor: 17 47 | updateInterval: 3 48 | returnType: 1 49 | sensorOutputNumber: 0 50 | vector3Value: {fileID: 0} 51 | intValue: {fileID: 11400000, guid: 63f2fdec2251ef0429d9a099b89da141, type: 2} 52 | floatValue: {fileID: 0} 53 | modifiers: [] 54 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Prefabs/Sensors/PRE_Stepcount.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ddfc12726d4f7b49ab7a92111c7ed80 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 632e18f6dfa58dc429ce397566187b88 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Core.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ea85bc30e674087a33c2e6c40a88e53 3 | timeCreated: 1547897464 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Core/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad15405de7e24ee2b5ad69a358436e68 3 | timeCreated: 1548018008 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Core/Editor/SensorReaderEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityAndroidSensors.Scripts.Utils.SmartVars; 3 | 4 | namespace UnityAndroidSensors.Scripts.Core.Editor 5 | { 6 | using UnityEditor; 7 | using UnityEngine; 8 | 9 | [CustomEditor(typeof(SensorReader), true), CanEditMultipleObjects] 10 | public class SensorReaderEditor : Editor 11 | { 12 | private MonoScript script; 13 | 14 | private SerializedProperty returnTypeProperty; 15 | private SerializedProperty updateIntervalProperty; 16 | private SerializedProperty vector3ValueProperty; 17 | private SerializedProperty intValueProperty; 18 | private SerializedProperty floatValueProperty; 19 | private SerializedProperty sensorProperty; 20 | private SerializedProperty sensorOutputNumberProperty; 21 | private SerializedProperty modifierProperty; 22 | private GUIStyle addModifierButtonStyle; 23 | private GUIStyle removeButtonStyle; 24 | 25 | private SensorReader sensor; 26 | private bool showModifier = true; 27 | 28 | private readonly Color removeButtonColor = new Color(1, 0.4f, 0.4f); 29 | private readonly Color addButtonColor = new Color(0, 0.8f, 0.4f); 30 | private readonly string descriptionText = "Add a smart event listener"; 31 | 32 | private void OnEnable() 33 | { 34 | sensor = (SensorReader) target; 35 | 36 | script = MonoScript.FromMonoBehaviour((SensorReader) target); 37 | 38 | returnTypeProperty = serializedObject.FindProperty("returnType"); 39 | updateIntervalProperty = serializedObject.FindProperty("updateInterval"); 40 | vector3ValueProperty = serializedObject.FindProperty("vector3Value"); 41 | intValueProperty = serializedObject.FindProperty("intValue"); 42 | floatValueProperty = serializedObject.FindProperty("floatValue"); 43 | sensorOutputNumberProperty = serializedObject.FindProperty("sensorOutputNumber"); 44 | sensorProperty = serializedObject.FindProperty("sensor"); 45 | modifierProperty = serializedObject.FindProperty("modifiers"); 46 | } 47 | 48 | public override void OnInspectorGUI() 49 | { 50 | serializedObject.Update(); 51 | 52 | GUI.enabled = false; 53 | EditorGUILayout.ObjectField("Script", script, typeof(SensorReader), false); 54 | GUI.enabled = true; 55 | 56 | EditorGUILayout.PropertyField(sensorProperty, new GUIContent("Sensor Type")); 57 | EditorGUILayout.PropertyField(returnTypeProperty); 58 | DrawOutput(sensor.returnType); 59 | EditorGUILayout.PropertyField(updateIntervalProperty); 60 | EditorGUILayout.Space(); 61 | DrawModifiers(); 62 | 63 | serializedObject.ApplyModifiedProperties(); 64 | } 65 | 66 | private void DrawModifiers() 67 | { 68 | if (sensor.modifiers == null) { 69 | return; 70 | } 71 | 72 | showModifier = EditorGUILayout.Foldout(showModifier, "Modifiers"); 73 | 74 | if (showModifier) { 75 | 76 | DrawAddModifierButton(); 77 | 78 | EditorGUILayout.BeginVertical(); 79 | for (int i = 0; i < modifierProperty.arraySize; i++) 80 | { 81 | EditorGUILayout.BeginHorizontal(); 82 | 83 | removeButtonStyle = new GUIStyle(GUI.skin.button) { 84 | fixedWidth = 20, 85 | margin = new RectOffset(0, 15, 0, 0) 86 | }; 87 | 88 | Color defaultColor = GUI.backgroundColor; 89 | GUI.backgroundColor = removeButtonColor; 90 | 91 | DrawButton("-", removeButtonStyle, removeButtonColor, 92 | () => { sensor.modifiers.Remove(sensor.modifiers[i]); }); 93 | 94 | GUI.backgroundColor = defaultColor; 95 | 96 | EditorGUILayout.PropertyField(modifierProperty.GetArrayElementAtIndex(i), GUIContent.none); 97 | 98 | EditorGUILayout.EndHorizontal(); 99 | } 100 | EditorGUILayout.EndVertical(); 101 | 102 | } 103 | } 104 | 105 | 106 | private void DrawButton(string text, GUIStyle style, Color color, Action callback) 107 | { 108 | Color defaultColor = GUI.backgroundColor; 109 | GUI.backgroundColor = color; 110 | 111 | if (GUILayout.Button(text, style)) { 112 | callback?.Invoke(); 113 | } 114 | 115 | GUI.backgroundColor = defaultColor; 116 | } 117 | 118 | private void DrawAddModifierButton() 119 | { 120 | EditorGUILayout.Space(); 121 | 122 | addModifierButtonStyle = new GUIStyle(GUI.skin.button) {fixedWidth = 100}; 123 | 124 | EditorGUILayout.BeginHorizontal(); 125 | //GUILayout.FlexibleSpace(); 126 | 127 | DrawButton("Add Modifier", addModifierButtonStyle, addButtonColor, () => 128 | { 129 | sensor.modifiers.Add(null); 130 | }); 131 | 132 | EditorGUILayout.EndHorizontal(); 133 | } 134 | 135 | private void DrawOutput(SmartVarType returnType) 136 | { 137 | GUIContent valueLabel = new GUIContent("Value"); 138 | switch (returnType) 139 | { 140 | case SmartVarType.Vector3: 141 | EditorGUILayout.PropertyField(vector3ValueProperty, valueLabel); 142 | break; 143 | case SmartVarType.Int: 144 | EditorGUILayout.PropertyField(sensorOutputNumberProperty, new GUIContent("Index")); 145 | EditorGUILayout.PropertyField(intValueProperty, valueLabel); 146 | break; 147 | case SmartVarType.Float: 148 | EditorGUILayout.PropertyField(sensorOutputNumberProperty, new GUIContent("Index")); 149 | EditorGUILayout.PropertyField(floatValueProperty, valueLabel); 150 | break; 151 | } 152 | } 153 | } 154 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Core/Editor/SensorReaderEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e5493df5dcf14404be906771e1b75941 3 | timeCreated: 1548018026 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Core/Sensor.cs: -------------------------------------------------------------------------------- 1 | namespace UnityAndroidSensors.Scripts.Core 2 | { 3 | public enum Sensor 4 | { 5 | accelerometer, 6 | ambientTemperature, 7 | gamerotationVector, 8 | geomagneticRotationVector, 9 | gravity, 10 | gyroscope, 11 | gyroscopeuncalibrated, 12 | heartrate, 13 | light, 14 | linearAcceleration, 15 | magneticfield, 16 | magneticfieldUncalibrated, 17 | pressure, 18 | proximity, 19 | relativeHumidity, 20 | rotationVector, 21 | significantMotion, 22 | stepcounter, 23 | stepdetector, 24 | } 25 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Core/Sensor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e07669844de2445fa46bea093d107106 3 | timeCreated: 1548017759 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Core/SensorReader.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityAndroidSensors.Scripts.Modifier; 3 | using UnityAndroidSensors.Scripts.Utils.SmartVars; 4 | using UnityEngine; 5 | 6 | namespace UnityAndroidSensors.Scripts.Core 7 | { 8 | /** 9 | * Reads the selected sensor values and save this into a smart var which can be 10 | * used elsewhere. You can also determine the update frequency. 11 | */ 12 | public class SensorReader : MonoBehaviour 13 | { 14 | #region Variables 15 | 16 | public Sensor sensor; 17 | 18 | [Tooltip("Updates every x frames")] 19 | [Range(1,60)] 20 | public int updateInterval = 3; 21 | 22 | public SmartVarType returnType; 23 | public SensorReturnIndex sensorOutputNumber; 24 | public Vector3Var vector3Value; 25 | public IntVar intValue; 26 | public FloatVar floatValue; 27 | 28 | public List modifiers = new List(); 29 | 30 | #endregion 31 | 32 | private void Start() 33 | { 34 | #if UNITY_EDITOR 35 | return; 36 | #endif 37 | 38 | UnitySensorPlugin.Instance.StartListenting(sensor); 39 | } 40 | 41 | private void Update() 42 | { 43 | #if UNITY_EDITOR 44 | return; 45 | #endif 46 | 47 | if (Time.frameCount % updateInterval == 0) { 48 | 49 | float[] values = UnitySensorPlugin.Instance.GetSensorValue(sensor); 50 | ApplyModifier(ref values); 51 | 52 | switch (returnType) 53 | { 54 | case SmartVarType.Vector3: 55 | vector3Value.value = new Vector3( 56 | values[0], 57 | values[1], 58 | values[2]); 59 | 60 | break; 61 | case SmartVarType.Int: 62 | intValue.value = (int) values[(int) sensorOutputNumber]; 63 | break; 64 | case SmartVarType.Float: 65 | floatValue.value = values[(int)sensorOutputNumber]; 66 | break; 67 | } 68 | } 69 | } 70 | 71 | private void ApplyModifier(ref float[] values) 72 | { 73 | if (modifiers == null) { 74 | return; 75 | } 76 | 77 | foreach (SensorValueModifier modifier in modifiers) { 78 | if (modifier == null) { 79 | continue; 80 | } 81 | 82 | modifier.Modify(ref values); 83 | } 84 | } 85 | } 86 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Core/SensorReader.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cb9c681ce8b741b4bd99b9830a29b769 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: f66c379aa069ed54ab86852d43c29da4, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Core/SensorReturnIndex.cs: -------------------------------------------------------------------------------- 1 | namespace UnityAndroidSensors.Scripts.Core 2 | { 3 | public enum SensorReturnIndex 4 | { 5 | x = 0, 6 | y = 1, 7 | z = 2 8 | } 9 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Core/SensorReturnIndex.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2ae64d29d4cfdf409f63c9ba57cda95 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Core/UnitySensorPlugin.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UnityAndroidSensors.Scripts.Core 4 | { 5 | /** 6 | * Handles the connection between Unity and the Android Sensor Manager 7 | */ 8 | public class UnitySensorPlugin : MonoBehaviour 9 | { 10 | public static UnitySensorPlugin Instance { get; private set; } 11 | 12 | private const string SensorValues = "getSensorValues"; 13 | private const string StartListening = "startSensorListening"; 14 | private const string PathToJarClass = "de.marcusmeiburg.plugin.UnitySensorPlugin"; 15 | private const string GetInstanceMethodName = "getInstance"; 16 | private const string TerminateMethodName = "terminate"; 17 | 18 | /* Reference to java instance*/ 19 | private AndroidJavaObject plugin; 20 | 21 | private void Awake() 22 | { 23 | if (Instance == null) { 24 | Instance = this; 25 | 26 | #if UNITY_ANDROID 27 | InitializePlugin(); 28 | #endif 29 | 30 | DontDestroyOnLoad(this); 31 | } else if(Instance != this) { 32 | Destroy(this); 33 | } 34 | } 35 | 36 | public void StartListenting(Sensor sensor) 37 | { 38 | #if UNITY_ANDROID 39 | plugin?.Call(StartListening, sensor.ToString().ToLower()); 40 | #endif 41 | } 42 | 43 | public float[] GetSensorValue(Sensor sensor) 44 | { 45 | if (plugin == null) { 46 | return new float[1]; 47 | } 48 | 49 | #if UNITY_ANDROID 50 | return plugin.Call(SensorValues, sensor.ToString().ToLower()); 51 | #endif 52 | 53 | return null; 54 | } 55 | 56 | private void OnApplicationQuit () 57 | { 58 | #if UNITY_ANDROID 59 | TerminatePlugin(); 60 | #endif 61 | } 62 | 63 | private void InitializePlugin() 64 | { 65 | using (AndroidJavaClass pluginClass = 66 | new AndroidJavaClass(PathToJarClass)) { 67 | 68 | plugin = pluginClass 69 | .CallStatic(GetInstanceMethodName); 70 | } 71 | } 72 | 73 | private void TerminatePlugin() 74 | { 75 | if (plugin == null) { 76 | return; 77 | } 78 | 79 | plugin.Call(TerminateMethodName); 80 | plugin = null; 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Core/UnitySensorPlugin.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f1bb6f7f93e478f8a566b4fa6660e03 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Detectors.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a3f7e04cfcc340c5981f678c03e6547b 3 | timeCreated: 1547897558 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Detectors/ShakeDetector.cs: -------------------------------------------------------------------------------- 1 | using UnityAndroidSensors.Scripts.Utils; 2 | using UnityAndroidSensors.Scripts.Utils.SmartEvents; 3 | using UnityAndroidSensors.Scripts.Utils.SmartVars; 4 | using UnityEngine; 5 | using UnityEngine.Events; 6 | 7 | namespace UnityAndroidSensors.Scripts.Detectors 8 | { 9 | /** 10 | * Detects if the acceleration sensor value change from one to another frame is higher than a threshold. 11 | * If it is, the onShakeEvent get triggered. 12 | */ 13 | public class ShakeDetector : MonoBehaviour 14 | { 15 | [SerializeField] 16 | private Vector3Var acceleration; 17 | [SerializeField] 18 | private SmartEvent onShakeEvent; 19 | 20 | private const float AccelerometerUpdateInterval = 1.0f / 60.0f; 21 | private const float LowPassKernelWidthInSeconds = 1.0f; 22 | 23 | private float shakeDetectionThreshold = 2.0f; 24 | private float lowPassFilterFactor; 25 | private Vector3 lowPassValue; 26 | 27 | private void Start() 28 | { 29 | lowPassFilterFactor = AccelerometerUpdateInterval / LowPassKernelWidthInSeconds; 30 | shakeDetectionThreshold *= shakeDetectionThreshold; 31 | lowPassValue = Input.acceleration; 32 | } 33 | 34 | private void Update() 35 | { 36 | lowPassValue = Vector3.Lerp(lowPassValue, acceleration.value, lowPassFilterFactor); 37 | Vector3 deltaAcceleration = acceleration.value - lowPassValue; 38 | 39 | if (deltaAcceleration.sqrMagnitude >= shakeDetectionThreshold) { 40 | onShakeEvent?.Invoke(); 41 | } 42 | 43 | #if UNITY_EDITOR 44 | 45 | if (Input.GetKeyDown(KeyCode.Return)) { 46 | onShakeEvent?.Invoke(); 47 | } 48 | 49 | #endif 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Detectors/ShakeDetector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4d00824c94a43229a348b6f86f098c0 3 | timeCreated: 1543705521 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Modifier.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6640ef511f2142f38bc7ae3d21496e6f 3 | timeCreated: 1548082717 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Modifier/AccelerationLowPassModifier.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UnityAndroidSensors.Scripts.Modifier 4 | { 5 | [CreateAssetMenu(menuName = "SensorPlugin/Modifiers/AccelerationLowPassModifier")] 6 | public class AccelerationLowPassModifier : SensorValueModifier 7 | { 8 | private const float Alpha = 10f; 9 | 10 | public override void Modify(ref float[] values) 11 | { 12 | values[0] = LowPass(values[0]) * -1f; 13 | values[1] = LowPass(values[1]) * -1f; 14 | values[2] = LowPass(values[2]) * -1f; 15 | 16 | // Could also archive with build in unity methods, 17 | // but hey we want to be real hackers and get the values by our self 18 | // value.value.x = Input.acceleration.x; 19 | // value.value.y = Input.acceleration.y; 20 | // value.value.z = Input.acceleration.z; 21 | } 22 | 23 | private float LowPass(float value) 24 | { 25 | return Mathf.Round((value / Alpha) * 100f) / 100f; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Modifier/AccelerationLowPassModifier.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dced765f95bc460e86beffbf44de3bfd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 8ff2668573f30d64e85af86e2516ea9f, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Modifier/SensorValueModifier.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UnityAndroidSensors.Scripts.Modifier 4 | { 5 | public abstract class SensorValueModifier : ScriptableObject 6 | { 7 | /** 8 | * Modify the values of the sensor in this method. values are 9 | * The values are given as a reference and can directly modified 10 | * within the method, no need for a return type 11 | */ 12 | public abstract void Modify(ref float[] values); 13 | } 14 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Modifier/SensorValueModifier.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 16916a8ee3561064f947ac85f5e0738e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2393ba769b624fa4811683a439461fdb 3 | timeCreated: 1547897500 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/Comparator.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd6cdcbf8e210264c9de7e4f4f5dec9a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/Comparator/FloatVarComparator.cs: -------------------------------------------------------------------------------- 1 | using UnityAndroidSensors.Scripts.Utils.SmartVars; 2 | 3 | namespace UnityAndroidSensors.Scripts.Utils.Comparator 4 | { 5 | public class FloatVarComparator : SmartVarComparator {} 6 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/Comparator/FloatVarComparator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0871dd0bbe0b4296a800833bfababfd5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: f88c6fbd5f5330845ad821bf65b18fab, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/Comparator/IntVarComparator.cs: -------------------------------------------------------------------------------- 1 | using UnityAndroidSensors.Scripts.Utils.SmartVars; 2 | 3 | namespace UnityAndroidSensors.Scripts.Utils.Comparator 4 | { 5 | public class IntVarComparator : SmartVarComparator {} 6 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/Comparator/IntVarComparator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c34b0e836bfa4f0b8cd9073cff676738 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: f88c6fbd5f5330845ad821bf65b18fab, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/Comparator/SmartVarComparator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityAndroidSensors.Scripts.Utils.SmartEvents; 3 | using UnityAndroidSensors.Scripts.Utils.SmartVars; 4 | using UnityEngine; 5 | using UnityEngine.Events; 6 | 7 | namespace UnityAndroidSensors.Scripts.Utils.Comparator 8 | { 9 | public enum CompareCondition 10 | { 11 | Equal, 12 | Greater, 13 | GreaterEqual, 14 | Less, 15 | LessEqual 16 | } 17 | 18 | public enum EventChoiceType 19 | { 20 | SmartEvent, 21 | UnityEvent, 22 | Both 23 | } 24 | 25 | public abstract class SmartVarComparator : MonoBehaviour 26 | where TVarType : SmartVar 27 | where TType : IComparable 28 | { 29 | public UnityEvent unityEvent; 30 | public SmartEvent smartEvent; 31 | public EventChoiceType eventChoiceType; 32 | 33 | public CompareCondition condition; 34 | 35 | [Tooltip("Use constant")] 36 | public bool useConst = true; 37 | public TType constant; 38 | 39 | public TVarType var1; 40 | public TVarType var2; 41 | 42 | private TType lastValue; 43 | 44 | private void Update() 45 | { 46 | CompareAndInvoke(); 47 | 48 | if (var1 != null) { 49 | lastValue = var1.value; 50 | } 51 | } 52 | 53 | private void CompareAndInvoke() 54 | { 55 | if (var1 == null) { 56 | Debug.LogError("Var1 should be set", gameObject); 57 | return; 58 | } 59 | 60 | if (var2 == null && !useConst) { 61 | Debug.LogError("Var2 should be set", gameObject); 62 | return; 63 | } 64 | 65 | int compare = var1.value.CompareTo(useConst ? constant : var2.value); 66 | int compareLast = lastValue.CompareTo(useConst ? constant : var2.value); 67 | 68 | if (condition == CompareCondition.GreaterEqual && compare >= 0 && compareLast < 0 || 69 | condition == CompareCondition.Equal && compare == 0 && (compareLast < 0 || compareLast > 0) || 70 | condition == CompareCondition.Greater && compare > 0 && compareLast <= 0 || 71 | condition == CompareCondition.Less && compare < 0 && compareLast >= 0 || 72 | condition == CompareCondition.LessEqual && compare <= 0 && compareLast > 0) { 73 | 74 | switch (eventChoiceType) { 75 | case EventChoiceType.Both: 76 | InvokeSmartEvent(); 77 | InvokeUnityEvent(); 78 | break; 79 | case EventChoiceType.SmartEvent: 80 | InvokeSmartEvent(); 81 | break; 82 | case EventChoiceType.UnityEvent: 83 | InvokeUnityEvent(); 84 | break; 85 | } 86 | } 87 | } 88 | 89 | private void InvokeSmartEvent() 90 | { 91 | smartEvent?.Invoke(); 92 | } 93 | 94 | private void InvokeUnityEvent() 95 | { 96 | unityEvent?.Invoke(); 97 | } 98 | } 99 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/Comparator/SmartVarComparator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 250f939c48e34d0aada7ba6941645bce 3 | timeCreated: 1547899747 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97461f1805f643bc87945f4ced25d481 3 | timeCreated: 1548065004 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/Editor/FloatVarComparatorEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityAndroidSensors.Scripts.Utils.Comparator; 2 | using UnityEditor; 3 | 4 | namespace UnityAndroidSensors.Scripts.Utils.Editor 5 | { 6 | [CustomEditor(typeof(FloatVarComparator)), CanEditMultipleObjects] 7 | public class FloatVarComparatorEditor : SmartVarComparatorEditor 8 | { 9 | protected override MonoScript GetScript() 10 | { 11 | return MonoScript.FromMonoBehaviour((FloatVarComparator) target); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/Editor/FloatVarComparatorEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7205df94927f4f6ebf1cf5ccf65f083d 3 | timeCreated: 1548067017 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/Editor/IntVarComparatorEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityAndroidSensors.Scripts.Utils.Comparator; 2 | using UnityEditor; 3 | 4 | namespace UnityAndroidSensors.Scripts.Utils.Editor 5 | { 6 | [CustomEditor(typeof(IntVarComparator)), CanEditMultipleObjects] 7 | public class IntVarComparatorEditor : SmartVarComparatorEditor 8 | { 9 | protected override MonoScript GetScript() 10 | { 11 | return MonoScript.FromMonoBehaviour((IntVarComparator) target); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/Editor/IntVarComparatorEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 535503c4917c438daaf48fcd9619a15a 3 | timeCreated: 1548067078 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/Editor/SmartVarComparatorEditor.cs: -------------------------------------------------------------------------------- 1 | namespace UnityAndroidSensors.Scripts.Utils.Editor 2 | { 3 | using UnityEditor; 4 | using UnityEngine; 5 | 6 | [CanEditMultipleObjects] 7 | public abstract class SmartVarComparatorEditor : Editor 8 | { 9 | private MonoScript script; 10 | 11 | private SerializedProperty constant; 12 | private SerializedProperty unityEvent; 13 | private SerializedProperty smartEvent; 14 | private SerializedProperty eventChoiceType; 15 | private SerializedProperty condition; 16 | private SerializedProperty useConst; 17 | private SerializedProperty var1; 18 | private SerializedProperty var2; 19 | 20 | private static GUIStyle popupStyle; 21 | private readonly string[] comparisonChoice = 22 | { "Use Constant", "Use Variable"}; 23 | 24 | private void OnEnable() 25 | { 26 | script = GetScript(); 27 | 28 | var1 = serializedObject.FindProperty("var1"); 29 | condition = serializedObject.FindProperty("condition"); 30 | var2 = serializedObject.FindProperty("var2"); 31 | unityEvent = serializedObject.FindProperty("unityEvent"); 32 | smartEvent = serializedObject.FindProperty("smartEvent"); 33 | eventChoiceType = serializedObject.FindProperty("eventChoiceType"); 34 | constant = serializedObject.FindProperty("constant"); 35 | useConst = serializedObject.FindProperty("useConst"); 36 | } 37 | 38 | protected abstract MonoScript GetScript(); 39 | 40 | public override void OnInspectorGUI() 41 | { 42 | serializedObject.Update(); 43 | 44 | popupStyle = new GUIStyle(GUI.skin.GetStyle("PaneOptions")) 45 | { 46 | imagePosition = ImagePosition.ImageOnly, 47 | }; 48 | 49 | GUILayout.BeginVertical(); 50 | 51 | GUI.enabled = false; 52 | EditorGUILayout.ObjectField("Script", script, GetType(), false); 53 | GUI.enabled = true; 54 | 55 | GUILayout.Label("Comparison", EditorStyles.boldLabel); 56 | GUILayout.BeginHorizontal(); 57 | EditorGUILayout.PropertyField(var1, GUIContent.none, true); 58 | EditorGUILayout.PropertyField(condition, GUIContent.none, true); 59 | 60 | GUILayout.BeginHorizontal(); 61 | 62 | EditorGUILayout.PropertyField(useConst.boolValue ? constant : var2, GUIContent.none, true); 63 | 64 | useConst.boolValue = EditorGUILayout.Popup( 65 | useConst.boolValue ? 0 : 1, comparisonChoice, 66 | popupStyle, GUILayout.MaxWidth(20)) == 0; 67 | 68 | GUILayout.EndHorizontal(); 69 | GUILayout.EndHorizontal(); 70 | GUILayout.Label("Event", EditorStyles.boldLabel); 71 | 72 | EditorGUILayout.PropertyField(eventChoiceType, GUIContent.none); 73 | int enumIndex = eventChoiceType.enumValueIndex; 74 | 75 | if (enumIndex == 0 || enumIndex == 2) { 76 | EditorGUILayout.PropertyField(smartEvent, GUIContent.none); 77 | } 78 | 79 | if (enumIndex == 1 || enumIndex == 2) { 80 | EditorGUILayout.PropertyField(unityEvent, GUIContent.none); 81 | } 82 | 83 | GUILayout.EndVertical(); 84 | 85 | serializedObject.ApplyModifiedProperties(); 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/Editor/SmartVarComparatorEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 88a0a55d1d984fc3908501ddcc79dc82 3 | timeCreated: 1548065016 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartEvents.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b4dc398a38642b291ed5d2facb15e51 3 | timeCreated: 1547932726 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartEvents/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a7205d46c8e44646a66aa972b9ced5f6 3 | timeCreated: 1548177009 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartEvents/Editor/ListenSmartEventEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityAndroidSensors.Scripts.Utils.SmartEvents.Editor 5 | { 6 | using UnityEditor; 7 | 8 | [CustomEditor(typeof(ListenSmartEvent))] 9 | public class ListenSmartEventEditor : Editor 10 | { 11 | private SerializedProperty events; 12 | private ListenSmartEvent listenSmartEvent; 13 | private MonoScript script; 14 | 15 | private readonly Color removeButtonColor = new Color(1, 0.4f, 0.4f); 16 | private readonly Color addButtonColor = new Color(0, 0.8f, 0.4f); 17 | private readonly string descriptionText = "Add a smart event listener"; 18 | 19 | private void OnEnable() 20 | { 21 | script = MonoScript.FromMonoBehaviour((ListenSmartEvent) target); 22 | listenSmartEvent = (ListenSmartEvent) target; 23 | events = serializedObject.FindProperty("events"); 24 | } 25 | 26 | public override void OnInspectorGUI() 27 | { 28 | serializedObject.Update(); 29 | 30 | GUI.enabled = false; 31 | EditorGUILayout.ObjectField("Script", script, typeof(ListenSmartEvent), false); 32 | GUI.enabled = true; 33 | EditorGUILayout.BeginVertical(); 34 | 35 | int countOfSmartEvents = listenSmartEvent.events?.Count ?? 0; 36 | 37 | GUIStyle addButtonStyle = new GUIStyle(GUI.skin.button) { 38 | fixedWidth = 100, 39 | margin = new RectOffset(0, 15, 0, 0) 40 | }; 41 | 42 | DrawButton("Add Listener", addButtonStyle, addButtonColor, () => 43 | { 44 | SmartEventListener listener = new SmartEventListener(); 45 | 46 | if (countOfSmartEvents > 0) { 47 | listener.Event = listenSmartEvent.events[countOfSmartEvents - 1].Event; 48 | } 49 | listenSmartEvent.events.Add(listener); 50 | }); 51 | 52 | EditorGUILayout.Space(); 53 | 54 | for (int i = 0; i < events.arraySize; i++) 55 | { 56 | EditorGUILayout.BeginHorizontal(); 57 | 58 | GUIStyle removeButtonStyle = new GUIStyle(GUI.skin.button) { 59 | fixedWidth = 30, 60 | fixedHeight = 30, 61 | margin = new RectOffset(0, 15, 0, 0) 62 | }; 63 | 64 | DrawButton("-", removeButtonStyle, removeButtonColor, 65 | () => { listenSmartEvent.events.Remove(listenSmartEvent.events[i]); }); 66 | 67 | EditorGUILayout.PropertyField(events.GetArrayElementAtIndex(i), GUIContent.none); 68 | 69 | EditorGUILayout.EndHorizontal(); 70 | } 71 | 72 | EditorGUILayout.EndVertical(); 73 | serializedObject.ApplyModifiedProperties(); 74 | } 75 | 76 | private void DrawButton(string text, GUIStyle style, Color color, Action callback) 77 | { 78 | Color defaultColor = GUI.backgroundColor; 79 | GUI.backgroundColor = color; 80 | 81 | if (GUILayout.Button(text, style)) { 82 | callback?.Invoke(); 83 | } 84 | 85 | GUI.backgroundColor = defaultColor; 86 | 87 | } 88 | } 89 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartEvents/Editor/ListenSmartEventEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 80d78fedd7cf4a8f853a0debdcce2ce5 3 | timeCreated: 1548178414 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartEvents/Editor/SmartEventListenerDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | namespace UnityAndroidSensors.Scripts.Utils.SmartEvents.Editor 5 | { 6 | [CustomPropertyDrawer(typeof(SmartEventListener))] 7 | public class SmartEventListenerDrawer : PropertyDrawer 8 | { 9 | private SerializedProperty smartEvent; 10 | private SerializedProperty unityEvent; 11 | 12 | private float smartEventHeight; 13 | private float unityEventHeight; 14 | 15 | private const float GabBetween = 10; 16 | private const float BottomSpace = 5; 17 | 18 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 19 | { 20 | smartEvent = property.FindPropertyRelative("Event"); 21 | unityEvent = property.FindPropertyRelative("response"); 22 | smartEventHeight = EditorGUI.GetPropertyHeight(smartEvent); 23 | unityEventHeight = EditorGUI.GetPropertyHeight(unityEvent); 24 | return smartEventHeight + unityEventHeight + GabBetween + BottomSpace; 25 | } 26 | 27 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 28 | { 29 | EditorGUI.BeginProperty(position, label, property); 30 | 31 | var indent = EditorGUI.indentLevel; 32 | EditorGUI.indentLevel = 0; 33 | 34 | var smartEventRect = 35 | new Rect(position.x, position.y, position.width, smartEventHeight); 36 | var unityEventRect = 37 | new Rect(position.x, position.y + smartEventHeight + GabBetween, position.width, unityEventHeight); 38 | 39 | EditorGUI.PropertyField(smartEventRect, smartEvent, GUIContent.none); 40 | EditorGUI.PropertyField(unityEventRect, unityEvent, GUIContent.none); 41 | 42 | EditorGUI.indentLevel = indent; 43 | 44 | EditorGUI.EndProperty(); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartEvents/Editor/SmartEventListenerDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02a9ed75351245978112b3b66a11d34d 3 | timeCreated: 1548177026 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartEvents/ListenSmartEvent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | using UnityEngine.Events; 4 | 5 | namespace UnityAndroidSensors.Scripts.Utils.SmartEvents 6 | { 7 | public class ListenSmartEvent : MonoBehaviour 8 | { 9 | public List events = new List(); 10 | 11 | private void OnEnable() 12 | { 13 | foreach (SmartEventListener item in events) { 14 | item.OnEnable(); 15 | } 16 | } 17 | 18 | private void OnDisable() 19 | { 20 | foreach (SmartEventListener item in events) { 21 | item.OnDisable(); 22 | } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartEvents/ListenSmartEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bcdb5f7cabc24d49992896d3bed7b248 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: f696ce1ecca7e314daf708c50d1b883d, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartEvents/SmartEvent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace UnityAndroidSensors.Scripts.Utils.SmartEvents 5 | { 6 | [CreateAssetMenu(menuName = "SensorPlugin/SmartData/Event")] 7 | public class SmartEvent : ScriptableObject, ISerializationCallbackReceiver 8 | { 9 | private List listener = new List(); 10 | 11 | public void Invoke() 12 | { 13 | foreach (SmartEventListener eventListener in listener) 14 | { 15 | eventListener.Invoke(); 16 | } 17 | } 18 | 19 | public void AddListener(SmartEventListener listener) 20 | { 21 | this.listener.Add(listener); 22 | } 23 | 24 | public void RemoveListener(SmartEventListener listener) 25 | { 26 | this.listener.Remove(listener); 27 | } 28 | 29 | public void OnBeforeSerialize() {} 30 | 31 | public void OnAfterDeserialize() 32 | { 33 | listener = new List(); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartEvents/SmartEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce468f54ae534b7f896dde3c787988f9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: b9304e071dd122d4696c7871b005c0f7, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartEvents/SmartEventListener.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.Events; 2 | 3 | namespace UnityAndroidSensors.Scripts.Utils.SmartEvents 4 | { 5 | [System.Serializable] 6 | public class SmartEventListener 7 | { 8 | public SmartEvent Event; 9 | public UnityEvent response; 10 | 11 | public void OnEnable() 12 | { 13 | Event?.AddListener(this); 14 | } 15 | 16 | public void OnDisable() 17 | { 18 | Event?.RemoveListener(this); 19 | } 20 | public void Invoke() 21 | { 22 | response?.Invoke(); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartEvents/SmartEventListener.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2908e1b31a8cd414f9244a90b0021e0f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartVars.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0af1f706c9ef42c98fc65194aabaad92 3 | timeCreated: 1547911369 -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartVars/FloatVar.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UnityAndroidSensors.Scripts.Utils.SmartVars 4 | { 5 | [CreateAssetMenu(menuName = "SensorPlugin/SmartData/FloatVar")] 6 | public class FloatVar : SmartVar {} 7 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartVars/FloatVar.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e15af3a5f3874b94b3af2330f899078c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 46bcffe80499dd34b86c4a5f7ef57ca0, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartVars/IntVar.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UnityAndroidSensors.Scripts.Utils.SmartVars 4 | { 5 | [CreateAssetMenu(menuName = "SensorPlugin/SmartData/IntVar")] 6 | public class IntVar : SmartVar {} 7 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartVars/IntVar.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e85a3ceeac3d7440bfec64569be43e4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 46bcffe80499dd34b86c4a5f7ef57ca0, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartVars/SmartVar.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityAndroidSensors.Scripts.Utils.SmartVars 5 | { 6 | public abstract class SmartVar : ScriptableObject, ISerializationCallbackReceiver 7 | { 8 | [NonSerialized] 9 | //[HideInInspector] 10 | public T value; 11 | 12 | public T defaultValue; 13 | 14 | public void OnAfterDeserialize() 15 | { 16 | value = defaultValue; 17 | } 18 | 19 | public void OnBeforeSerialize() {} 20 | } 21 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartVars/SmartVar.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 81c42438b25740cca8b658f5ae43e073 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartVars/SmartVarType.cs: -------------------------------------------------------------------------------- 1 | namespace UnityAndroidSensors.Scripts.Utils.SmartVars 2 | { 3 | public enum SmartVarType 4 | { 5 | Vector3, 6 | Int, 7 | Float 8 | } 9 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartVars/SmartVarType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: faee2366a03e5ae46ba394f74eab171c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartVars/Vector3Var.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UnityAndroidSensors.Scripts.Utils.SmartVars 4 | { 5 | [CreateAssetMenu(menuName = "SensorPlugin/SmartData/Vector3Var")] 6 | public class Vector3Var : SmartVar {} 7 | } -------------------------------------------------------------------------------- /UnityAndroidSensors/Scripts/Utils/SmartVars/Vector3Var.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd96a84ecd1c4749b01312c8cbcb7a06 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {fileID: 2800000, guid: 46bcffe80499dd34b86c4a5f7ef57ca0, type: 3} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityAndroidSensors/UnitySensorPlugin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmeiburg/unityAndroidSensors/970653e236e93ee0dd30f226e49f0af4f02d3fc4/UnityAndroidSensors/UnitySensorPlugin.jar -------------------------------------------------------------------------------- /UnityAndroidSensors/UnitySensorPlugin.jar.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 32beedcae2dd2f04eb6e3105f5505906 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | platformData: 13 | - first: 14 | Android: Android 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Any: 20 | second: 21 | enabled: 0 22 | settings: {} 23 | - first: 24 | Editor: Editor 25 | second: 26 | enabled: 0 27 | settings: 28 | DefaultValueInitialized: true 29 | userData: 30 | assetBundleName: 31 | assetBundleVariant: 32 | --------------------------------------------------------------------------------