-
Book Overview & Buying
-
Table Of Contents
Unity Android Game Development by Example Beginner's Guide
By :
To make sure everything is set up properly, we need a simple application to test with, and what better to do that with than a Hello World application?

Ch1_HelloWorld_CS works well for a project name.


android-sdk folder.HelloWorld will work well, and hit Enter twice: once to confirm the name and once to open it.Because this is the first chapter, it will be a simple Hello World application. Unity supports C#, JavaScript, and Boo as scripting languages. For consistency, this book will be using C#. If you, instead, wish to use JavaScript for your scripts, copies of all of the projects can be found with the other resources for this book and an _JS suffix for JavaScript.
Start and Update functions that Unity insists on including in every new script. Replace them with a bit of code that simply renders the words Hello World in the top-left corner of the screen. You can now close the script and return to Unity.public void OnGUI() {
GUILayout.Label("Hello World");
}HelloWorld script from the Project window and drop it on the Main Camera object in the Hierarchy window. Congratulations, you have just added your first bit of functionality to an object in Unity.HelloWorld script.HelloWorld and hit Save.

com.CompanyName.ProductName, and it is good practice to use the same company name across all of your products. For this book, we will be using com.TomPacktAndBegin.Ch1.HelloWorld for Bundle Identifier, opting to use an extra dot for organization.Ch1_HelloWorld.apk works well. Be sure to remember where it is, and hit Save.android-sdk folder inside the location where it was installed. The default would be C:\Program Files\Android\android-sdk for 32-bit Windows and C:\Program Files (x86)\Android\android-sdk for 64-bit Windows.apk has been made and we are ready to continue.platform tools folder in order to connect to our device. If you installed it to the default location, use:cd c:\program files\android\android-sdk\platform-tools
cd c:\program files (x86)\android\android-sdk\platform-tools
adb devices
-r indicates that it should override if an application is found with the same Bundle Identifier as the application we are trying to install. That way you can just update your game as you develop, rather than uninstalling before installing the new version each time you need to make an update. The path to the .apk file that you wish to install is shown in quotes as follows:adb install -r "c:\users\tom\desktop\packt\book\ch1_helloworld.apk"
platform-tools folder when issuing commands and not having the correct path to your .apk file surrounded by quotes.We created our very first Unity and Android application. Admittedly, it was just a simple Hello World application, but that is how it always starts. Also, it served very well for double-checking the device connection and for learning about the build process without all of the clutter from a game.
Try changing the icon for the application. It is a fairly simple procedure that you will undoubtedly want to perform as your game develops. How to do this was mentioned earlier in this section. But, as a reminder, take a look at Player Settings. Also, you will need to import an image. Take a look under Assets, in the menu bar, to know how to do this.
Change the font size
Change margin width
Change background colour