Chapter 8. Going Mobile

In this chapter, we will switch to the Android platform and see how we can deal with various issues that appear. We'll build an .apk package, test it, and state issues before we correct them one by one.

Once these issues are corrected, we'll add a touch and hold feature that will replace the right-click to display the elemental switch UI on power sources.

Finally, we'll add an in-game user interface customization system, letting the player move the in-game UI elements around the screen and place them as he wishes.

In this chapter, we will discuss the following topics:

  • Platform switching to Android
  • Building the .apk package for Android devices
  • Testing it on a device
  • Correcting mobile-specific issues
  • Creating a touch-and-hold system
  • Making the user interface customizable with draggable UI elements
  • Using Unity's Profiler
  • Using the Unity Remote app to avoid rebuilding after each modification
  • Retrieving debug logs and errors from the device

By the end of this chapter, you'll know how to switch to a mobile platform and will be aware of the different means that you have to test and debug your games both in the editor and directly on your device.

Note

For this chapter, having an Android device is recommended, but is not necessary.

Switching to Android

We can easily switch the project to the Android platform. Navigate to File | Build Settings, as shown here:

Switching to Android

In the Build Settings window that appears, select the Android platform, and click on the Switch Platform button:

Switching to Android

Wait for Unity to reimport assets for the Android platform. OK, we're ready to test our project on a mobile device!

Note

You need the Android SDK if you want Unity for Android to work. You can download ADT Bundle at https://developer.android.com/sdk/index.html#download and point the SDK's install folder in Unity's Edit | Preferences window under the External Tools tab.

Before we start testing the game, we'll prepare a few things concerning our main menu.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.12.156