![unity 5.4.2f2 layer unity 5.4.2f2 layer](https://codeminionblog.files.wordpress.com/2016/10/capture15.png)
Please let me know if that works for you as good as it works for me and tell me your tricks with Unity 3D and ARToolKit. You now have the knowledge to find and use those features which enables you to create great games with ARToolKit and Unity 3D.
Unity 5.4.2f2 layer manual#
Most of the features you need for a great game with ARToolKit, Unit圓D and Android are already there, but somehow hidden and require manual build steps to enable them. If you now build the UnityARPlayer again and replace it in your project you should have a crystal clear video and the autofocus function. tPreviewSize(highestPreviewSize.width,highestPreviewSize.height)
![unity 5.4.2f2 layer unity 5.4.2f2 layer](https://unity3d.com/sites/default/files/5_5_improvement_selectionoutline_0.png)
Log.d("CameraSurface","PreviewSize: " + highestPreviewSize.width + "x"+ highestPreviewSize.height + "/n") Log.d("CameraSurface","PreviewSize: " + size.width + "x"+ size.height + "/n") Ĭamera.Size highestPreviewSize = parameters.getSupportedPreviewSizes().get(0) List previewSizes = parameters.getSupportedPreviewSizes() Look for highest supported preview size and use that one.
Unity 5.4.2f2 layer code#
That code can be found on my GitHub repository. For a simple example, I enhanced the UnityARPlayer code to select the highest video resolution available on the phone. To solve that I propose to set the video resolution to a fixed value that suits you best. Additionally, for a great game I can imagine that you do not want to bother the user with selecting a video resolution. Sadly, due to the lack of the system menu button in the modern phones and the full-screen/immersive mode of the Unity games, that is hidden. Video resolutionĪs for the video resolution, you would need to access the preference activity which comes with the ARPlayer. More detailed information about building the UnityARPlayer can be found here. (You might want to take a copy for safety ? ) Copy that to your UnityProject/Assets/Plugins/Android and replace the existing version.The jar file is created into \/src/Android_Unity_Player_Source/AndroidStudioProj/UnityARPlayer/build/libs/UnityARPlayer.jar.Then you need to open the section for UnityARPlayer/Tasks/other/jarRelease.On the right of the Android Studio window there is a little Gradle-tab.You may need to fix the Build Tools version depending on what version you have installed.Select Open an existing Android Studio project.Clone the repository into an empty directory.To build the ARPlayer we need to follow these steps: So all we need to do is to clone the ARUnity5 Git repository and build the source code from there. Lucky again it was already merged to the master branch as well. Luckily the autofocus feature has already been implemented into the plugin and is available on GitHub. So I’m going to show you how you can fix that very quick. Also, the default video resolution when you run your game is 320×240 which leads to a very bad user experience like jittering (shaking) of the 3D model you want to put on the ARMarker. Unfortunately, that release is a bit old and does not contain such features like autofocus on Android. If you are creating a game with ARToolKit on Unity you most likely use the Unity 3D plugin from the website.