I am developing an Android application using Unity + ARCore, but I did not find many articles developing on Ubuntu, so I mainly summarized the environment construction. As of this time (2020/12/30), I used the newest versions of Unity and ARCore as much as possible.
We have developed an app that puts an object in the place when you tap the screen, which is explained in "Getting Started ARCore in Sapporo". However, the version of ARCore used in this article is a little old, so I changed it to the latest version.
--Development machine
I will not explain in detail how to install Unity on Ubuntu because there are other commentary articles.
$ chmod + x UnityHub.AppImage
$ ./UnityHub.AppImage
After waiting for a while, the installation is completed.
Gradle will also be installed if you add * Android Build Support * when installing Unity, but ARCore requires version 5.6.4 or higher. In my environment, the version of Gradle installed by default is older than this and I got a build error, so I installed it additionally. I installed * version 5.6.4 *.
$ mv gradle-5.6.4-all.zip ~/Unity/Hub/Editor/2019.4.17f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools
$ unzip gradle-5.6.4-all.zip
There are other articles that explain in detail here as well, so I will describe them briefly. The following are the settings in the Unity project.
--Change Platform to Android
-* File-> Build Settings , select "Android" and press "Switch Platform"
--Gradle path setting
- Edit-> Preferences-> External Tools-> Android-> Gradle *, uncheck Recommended and select the additionally installed Gradle folder.
(For my environment): / home/{user}/Unity/Hub/Editor/2019.4.17f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools/gradle-5.6.4
--Player settings
The following settings are required to connect the Android device to Ubuntu and install the app.
First connect your Android device to your PC and then run the lsusb
command to verify your vendor ID
$ lsusb
Bus 001 Device 015: ID 0fce:520a Sony Ericsson Mobile Communications AB
When multiple USB devices are connected to the PC, the number of results will be output. Look for your Android device in it. At the end of the line is the manufacturer's name, which you can see. The above is the result when Xperia 5 is connected in my environment. * 0fce * in this is the vendor ID. Use this value to add a device connection rule.
$ sudo vi /etc/udev/rules.d/51-android.rules
#Write the following in a file. Vendor ID changes according to the environment
UBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666", GROUP="plugdev"
The contents of P.50 ~ P.88 of "Getting Started ARCore in Sapporo" have been implemented almost as they are, but only the following changes have been made according to the ARCore version.
Installing Unity on Ubuntu -Note that I installed Unity2020.1 on Ubuntu 20.04
Gradle related
Unity app implementation -Getting Started ARCore in Sapporo -ARCore environment construction and plane detection in Unity 2019
Android device recognition -Settings for connecting the actual Android device on Ubuntu
Recommended Posts