How to Unity3D – Configure Project for Android and Run it on Mobile Device

unity-logoIn this tutorial, you start from scratch. You will install Unity3D, Android SDK, then configure a project for Android, and run it on a mobile device.

ScreenShot005.png

Steps

  1. Choose Your Mobile Plateforme
  2. Install Unity3D and Android Plugin
  3. Install AndroidWorks
  4. Install Android Driver (optional)
  5. Activate Dev Debug mode
  6. Configure Project
  7. Build, Run and Play!

1. Choose Your Mobile Plateforme

Targeting a technology is always the same. Because it change over time, it’s safer to choose the “largest lesser” version (and not the latest) at your product launch to allow you to reach most devices .

Examples:

  • 2016: choose Android 4.4, you’ll reach 80-90% of the devices.
  • 2012: choose Android 2.3.3, you’ll reach 70%…
  • 2010: choose Android 2.1…

https://en.wikipedia.org/wiki/Android_version_history

ScreenShot017.png

ScreenShot016.png


2. Install Unity3D And Android Plugin (Windows)

Unity3D and his Android package is needed.

  • download your installer (perso, pro, etc)
  • run installer
  • choose components
    • Example Project
    • Android Build Support
  • Wait for download to complete (4 Go)

ScreenShot004.png

ScreenShot003.png

ScreenShot003

ScreenShot004

ScreenShot006

ScreenShot007

ScreenShot008

ScreenShot009

ScreenShot006.png


3. Install AndroidWorks (Windows)

You need to install Android SDK for Unity3D compatibility (API 23/Android6.0 for Unity3D 5.6) and for your target devices (API 19/Android 4.4.2)

  • got to https://developer.nvidia.com/codeworks-android
    • Create and Nvidia account
    • download codeworks for Windows 64
  • install
  • wait for manager popup after download stage
    • check install Unity3D android target Version (6.0).
    • check install your android target Version (4.4).
    • uncheck NVidia stuff like Android NDK, Developer Tools
    • check  auto resolve
    • click next
  • ignore warnings
  • accepts licences
  • wait for download to complete (12 Go)

 

ScreenShot020.png

ScreenShot003.png

ScreenShot003

ScreenShot006

ScreenShot008.png

ScreenShot010.png

ScreenShot003.png

ScreenShot004.png

ScreenShot005.png

 

 

ScreenShot007.png

ScreenShot003.png

ScreenShot013.png

 

ScreenShot003.png

ScreenShot004

 

 


4. Install Android USB Driver (Windows)

Sometimes, to enable debug mode, you need to install a specific USB driver for your phone.

https://developer.android.com/studio/run/win-usb.html

ScreenShot009.png


5. Activate Dev Debug Mode (Android)

Settings > About Phone > Build number > Tap it 7 times to become developer;

Settings > Developer Options > USB Debugging.

https://www.kingoapp.com/root-tutorials/how-to-enable-usb-debugging-mode-on-android.htm

ScreenShot019.pngScreenShot018.png


6. Configure Project (Unity3d)

We will use the “Standard Assets Example Project”, but limit to only ONE scene because of the load of the entire project during deployment to the mobile device (one scene is 30sec, all scenes is 10min).

  • Open the Unity3d project
    • Update Build Settings
    • Check only ONE project
    • Choose Android, with dev build
  • Update Player Settings
    • Select Android
    • Choose targets API (ex 4.4)
  • Test it locally (Windows)
  • Save

ScreenShot005.png

 

ScreenShot015.png

ScreenShot025.png

ScreenShot026.png

ScreenShot028.png

ScreenShot027.png

ScreenShot029.png

ScreenShot030.png

ScreenShot032.png

ScreenShot034.png

ScreenShot004.png

ScreenShot005.png

ScreenShot006.pngScreenShot007.png


7. Build, Run and Play!

Project and device are ready.

  • Build and Run
  • Choose APK name, Save
  • Autorise usb debug on for device from android
  • Wait for deployment (‘Hold On’ popup)
  • Play!
  • Get APK from Project folder (on Windows, ‘Example Project.apk’)

ScreenShot003.png

ScreenShot003.png

ScreenShot022.png

ScreenShot007.png

ScreenShot008.png

ScreenShot009.png

ScreenShot010.png

ScreenShot004.png

ScreenShot005.png

ScreenShot004.png

ScreenShot003.png

ScreenShot003.png


 Conclusion

AndroidWorks provide a simple way to install and manage android sdk installation.

Choosing Android version first is better, because latter it’s harder to do that latter in the project: you can run into Unity3D API changes, or bugs in your game, and you don’t want to do that just before your final release!

These example have been tested on multiple devices:

  • LG G4 (2015)
    • Android 6.x
    • high specs
  • Samsung Galaxy A5 (2016)
    • Android 7.x
    • low specs
    • no gyro

If you change your mind about the Android Version, just relaunch AndroidWorks.

ScreenShot004.png

Source

https://github.com/DamienFremont/blog/tree/master/20170601-unity3d-configure-project-for-android-and-run-it

References

https://en.wikipedia.org/wiki/Android_version_history

https://store.unity.com

https://docs.nvidia.com/gameworks/content/developertools/mobile/androidworks/androidworks_install.htm

https://developer.android.com/studio/run/win-usb.html

https://www.kingoapp.com/root-tutorials/how-to-enable-usb-debugging-mode-on-android.htm

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s