Extreme Motion SDK – Unity for Android Quick Start Guide Extreme Reality 3/25/2014 Table of Contents 1 Verified Unity3D Versions ................................................................................................................................... 2 2 Android versions .................................................................................................................................................... 2 3 First Setup Targeting Android ........................................................................................................................... 3 3.1 Files .................................................................................................................................................................... 3 3.2 Procedure I – (recommended) ................................................................................................................. 3 3.3 Procedure 2 (advanced) ............................................................................................................................. 4 4 First Program ........................................................................................................................................................... 5 5 FAQ .............................................................................................................................................................................. 6 1 1 Verified Unity3D Versions Unity3d Free vs Pro versions: The SDK contains native-code and thus requires “Native code plugins support” feature of Unity. As of October 2013, Unity-free can be used for iOS & Android versions and Unity-Pro is required for Windows & In-editor development. It is recommended to have the Pro-version to allow you to develop & quickly-test inside the unity-editor, but it is also possible to use the Free-version and only test on an actual android device. Please see http://unity3d.com/unity/licenses for the most up-to-date list of features supported in each version of Unity. Unity3D versions support: Extreme Motion SDK was tested with Unity3D 3.5 to 4.2 versions. We recommend using Unity3D versions 4.1.3 or newer. If you wish to use Unity3D 3.5 Pro version, you should be able to copy the Plugins and Scripts directories (omitting any *.meta files) into the appropriate locations, and use them as-is. 2 Android versions Minimal Android version is : Android Ice cream sandwich 4.0.3 and above. (API level 15) The SDK does not run on Android Simulator. You have to use a real device. The SDK was tested on various Android ArmV7 devices from multiple manufactures, we recommend you use a strong quad-core devices. If you see an issue with your android device (which is version 4.0.3 and above), please send a mail to [email protected]. 2 3 First Setup Targeting Android 3.1 Files First make sure you have all the required sdk files. If you are using one of the extreme-motion sdk samples, all these files will already be copied to the right source locations and you can skip this stage: Copy the following files from the Android SDK into your project: (You can find the files and the exact folder structure under: Android\Samples\Unity\VisualSkeletonSample\Source\Assets\Plugins Make sure you download the “Android SDK Full version”, including the unity samples and not the small Android SDK core version) Under Assets\Plugins: Xtr3D.Net.dll Xtr3D.Net.ExtremeMotion.dll - required for the game compilation and build - required for the game compilation and build Under Assets\Plugins\Android\ AndroidManifest.xml - a manifest containing references to xtr3d activities and the minimal permissions needed to use the engine and camera. libs\armeabi-v7a\*.so - xtr3d native libraries. bin\api.jar - java api, used to init the engine inside the java activities. bin\Xtr3dOverrideActivity.jar - pre-compiled java xtr3d activities, which init the engine and the camera. (Tested with Unity 4.1.5) assets\EM_Trial.lic - your license file. src\* - source files for the bin\Xtr3dOverrideActivity.jar - you will only need to use them if you need to create a custom activity (procedure 2) [Optional] The following if you want to test inside the unity-editor on windows machine (requires Unity-Pro version). Under the root folder of your project, copy the entire Win32 bin folder from ExtremeMotionSDK. It will include 10-14 dlls files (depending on release date) and the EM_Trial.lic (your license file). Make sure to use the same release date for both the Android and the Win32 versions. 3.2 Procedure I – (recommended) Note: Most games do not need to customize the generated activity java-code and can use this option. If you must customize it, you need to use procedure-II below instead. Xtr3d supplies a pre-compiled Xtr3dOverrideActivity.jar and a matching AndroidManifest.xml file which invoke Xtr3dOverrideActivity instead of using the default activity source files created by unity. You are allowed to modify AndroidManifest.xml, as long as you only add permissions/features and do not change the activity names. 1. Open a project in unity, or create a new one 2. Change the build-settings by hitting “File” ”Build Settings”, as follows: a. Select the “Android” target in the “Platform” pane on the bottom left. b. Make sure “Google Android Project” (named "Create Eclipse Project layout" in some unity versions) is not marked. c. Click the “Player Settings...” button and verify that: i. Under “Resolution and Presentation” (see Error! Reference source not ound.): 1. Choose Default Orientation “Landscape Left”. 2. Use 32-bit Display Buffer” is checked. ii. Under “Other Settings” (see Error! Reference source not found.): 1. Minimum API Level is “Android 4.0.3” 2. “Device SDK” is selected in the “Optimization” section, as the “SDK Version”. Running in the simulator is not currently supported. 3. Select “.NET 2.0 Subset” as your “Api Compatibility Level” in the “Optimization” section. 3. In the “Build Settings” dialog, click “Build”. 4. Click Build&Run 3.3 Procedure 2 (advanced) Note: Use this procedure only if you need to modify the java-activity yourself. In any other case, it is better to use “procedure-I” which is described above. First read the unity documentation at: http://docs.unity3d.com/Documentation/Manual/PluginsForAndroid.html "Extending the UnityPlayerActivity Java Code" section. 1. Open a project in unity, or create a new one 2. Change the build-settings by hitting “File” ”Build Settings”, as follows: a. Select the “Android” target in the “Platform” pane on the bottom left. b. Make sure “Google Android Project” (named "Create Eclipse Project layout" in some unity versions) is marked. c. Click the “Player Settings...” button and verify that: i. Under “Resolution and Presentation” (see Error! Reference source not ound.): 1. Choose Default Orientation “Landscape Left”. 2. Use 32-bit Display Buffer” is checked. ii. Under “Other Settings” (see Error! Reference source not found.): 1. Minimum API Level is “Android 4.0.3” 2. “Device SDK” is selected in the “Optimization” section, as the “SDK Version”. Running in the simulator is not currently supported. 3. Select “.NET 2.0 Subset” as your “Api Compatibility Level” in the “Optimization” section. 3. In the “Build Settings” dialog, click “Build”. 4. Click Export 5. From here on, the instructions are outside the unity-editor. Open the eclipse project 6. Copy the source files from Assets\Plugins\Android\src\* and the AndroidManifest.xml into your project and edit them as needed for your custom activity. 7. Update the AndroidManifest.xml file, make sure it still contains references to the activity the minimal permissions needed to use the engine and camera. 8. Add a reference to the api.jar in the java-build-path (right-click on the project>properties->Java-build-party->Libraries->Add JARS... choose the api.jar) 9. Debug/Run the Android application from the eclipse. Note: Each time you click “Export” from the unity editor, the AndroidManifest.xml and the activity java files are deleted and the default unity file is copied. If you copy the customized AndroidManifest.xml and a jar containing the .class files of your customized sources into Assets\Plugins\Android and Assets\Plugins\Android\bin folders respectively, the unity editor will copy them instead. See the unit3d documentation above. 4 First Program Once you are ready to create your first Extreme Motion powered product, note: 1. Even once your app is up and running, the Extreme Motion engine may take some time to detect the user presence in front of the device; once detected, the user should assume the "Psi" position: raising both hands, elbows bent. To detect when these and other state transitions occur, you may monitor the "TrackingState" property of the obtained "Skeleton" object. When the latter changes to "Calibrating", you should give the user an indication to assume the "Psi" position, and hide the indication once the state changes to "Tracked". 2. Note that to re-calibrate, or introduce a new user to the system, you should call "Reset" on the "GeneratorSingleton" instance. For further information, go through the documented code-samples. 5 FAQ 1. Can I run inside Unity3D editor? Yes, on Windows platform, if you have the unity-pro version. Note that running inside the editor requires the Win32 sdk in addition to the android sdk. 2. Can I run the game in Android Simulator? No, running in the simulator is not supported at this time. 3. I see multiple .dex file problem This it means you still have some class/jar twice, delete the 2nd reference from the project and from the java-build-path. Clean the whole project and try again. 4. LoadLevel fails to work Re-create and re-export the whole eclipse project. 5. Runtime crash: "java.lang.RuntimeException: Unable to instantiate activity ComponentInfo" check the name of the activity in AndroidManifest.xml, it probably does not match the java code. 6. java.lang.NoClassDefFoundError: com.xtr3d.extrememotion.api.ExtremeMotionGenerator check the api.jar is added AND that it is checked in "Order and Export" 7. My application crash on start with SIGSEGV and has this error: ‘bsearch: assertion "key != NULL" failed’ on Android 4.3 version There is a known bug in Unity(specifically Mono) and Android4.3 , which happens in Unity 4.15 and is solved in 4.203 (maybe even before), please upgrade Unity Editor to that version.
© Copyright 2024 ExpyDoc