วันอาทิตย์ที่ 2 มีนาคม พ.ศ. 2557

Unity3D Game Build to Android



Unity3D Game Build to Android

Original Source Code from Unity Technologies.
https://www.assetstore.unity3d.com/#/content/13866


Getting Started with Android Development

Building games for a device running Android OS. However, the hardware is not completely standardized across all devices. There are some feature differences in the Android version.
Setting up your Android Developer environment
You will need to have your Android developer environment set up before you can test your Unity games on the device. This involves downloading and installing the Android SDK with the different Android platforms and adding your physical device to your system (this is done a bit differently depending on whether you are developing on Windows or Mac). This setup process is explained on the Android developer website, and there may be additional information provided by the manufacturer of your device. Since this is a complex process, we've provided a basic outline of the tasks that must be completed before you can run code on your Android device or in the Android emulator. However, the best thing to do is follow the instructions step-by-step from the Android developer portal.
Access Android Functionality
Unity Android provides scripting APIs to access various input data and settings. You can find out more about the available classes on the Android scripting page.
Exposing Native C, C++ or Java Code to Scripts
Unity Android allows you to call custom functions written in C/C++ directly from C# scripts (Java functions can be called indirectly). To find out how to make functions from native code accessible from Unity, visit the Android plugins page.
Occlusion Culling
Unity includes support for occlusion culling which is a particularly valuable optimization on mobile platforms. More information can be found on the occlusion culling page.
Splash Screen Customization
The splash screen displayed while the game launches can be customized - see this page for further details.
Troubleshooting and Bug Reports
There are many reasons why your application may crash or fail to work as you expected. Our Android troubleshooting guide will help you get to the bottom of bugs as quickly as possible. If, after consulting the guide, you suspect the problem is internal to Unity then you should file a bug report - see this page for details on how to do this.

How Unity Android Differs from Desktop Unity

Strongly Typed JavaScript

For performance reasons, dynamic typing in JavaScript is always turned off in Unity Android, as if #pragma strict were applied automatically to all scripts. This is important to know if you start with a project originally developed for the desktop platforms since you may find you get unexpected compile errors when switching to Android; dynamic typing is the first thing to investigate. These errors are usually easy to fix if you make sure all variables are explicitly typed or use type inference on initialization.

ETC as Recommended Texture Compression

Although Unity Android does support DXT/PVRTC/ATC textures, Unity will decompress the textures into RGB(A) format at runtime if those compression methods are not supported by the particular device in use. This could have an impact on the GPU rendering speed and it is recommended to use the ETC format instead. ETC is the de facto standard compression format on Android, and should be supported on all post 2.0 devices. However, ETC does not support an alpha channel and RGBA 16-bit will sometimes be the best trade-off between size, quality and rendering speed where alpha is required.
It is also possible to create separate android distribution archives (.apk) for each of the DXT/PVRTC/ATC formats, and let the Android Market's filtering system select the correct archives for different devices (see Publishing Builds for Android).

Movie Playback

Movie textures are not supported on Android, but a full-screen streaming playback is provided via scripting functions. To learn about supported file formats and scripting API, consult the movie page or the Android supported media formats page.


Android SDK Setup

There are some steps you must follow before you can build and run any code on your Android device. This is true regardless of whether you use Unity or write Android applications from scratch.

1. Download the Android SDK

Go to the Android Developer SDK webpage. Download and unpack the latest Android SDK.

2. Installing the Android SDK

Follow the instructions under Installing the SDK (although you can freely skip the optional parts relating to Eclipse). In step 4 of Installing the SDK be sure to add at least oneAndroid platform with API level equal to or higher than 9 (Platform 2.3 or greater), the Platform Tools, and the USB drivers if you're using Windows.

3. Get the device recognized by your system

This can be tricky, especially under Windows based systems where drivers tend to be a problem. Also, your device may come with additional information or specific drivers from the manufacturer.
For Windows: If the Android device is automatically recognized by the system you still might need to update the drivers with the ones that came with the Android SDK. This is done through the Windows Device Manager.
If the device is not recognized automatically use the drivers from the Android SDK, or any specific drivers provided by the manufacturer.
Additional info can be found here: USB Drivers for Windows
For Mac: If you're developing on Mac OSX then no additional drivers are usually required.
Note: Don't forget to turn on "USB Debugging" on your device. Go to Settings -> Developer options, then enable USB debugging. As of Android Jelly Bean 4.2 the Developer options are hidden by default. To enable them tap on Settings -> About Phone -> Build Version multiple times. Then you will be able to access the Settings -> Developer options.
If you are unsure whether your device is properly installed on your system, please read the trouble-shooting page for details.

4. Add the Android SDK path to Unity

The first time you build a project for Android (or if Unity later fails to locate the SDK) you will be asked to locate the folder where you installed the Android SDK (you should select the root folder of the SDK installation). The location of the Android SDK can also be changed in the editor by selecting Unity > Preferences from the menu and then clicking on External Tools in the preferences window.








How to Build App to Android  ( Unity 4.3.1 )

First  Android SDK Setup

Use Menu  :  Edit  -  Preferences  Then Select Android SDK Location



Set Google Play Publishing Settings 

Use Menu  :  Edit -  Project Settings - Player

  

Then Show PlayerSettings



Resolution and Presentation
You can set Android Device Screen Orientation.


Icon
show your icon on different screen android devices.


Splash Image
not use.

Other Settings
Set your Android Package , Version Code , Version Name and minimum sdk.



Publishing Settings
You can set keystore. Create New KeyStore or Use Existing KeyStore.



Android App on Google Play.




Space Shooter Game is simple demo 2D game from Unity Asset Store.
Easy Game for kid. Shoot Asteroid and enemy.
Use only one Finger to Play.

Original Source Code from Unity Technologies.
https://www.assetstore.unity3d.com/#/content/13866

How to Play
Use only one Finger to Play.
Touch to shoot lasers.
Touch to Move Left ,Right ,Up Down

เกมยิงยานอวกาศ Space Shooter Game
เกมที่ง่าย ๆ สำหรับเด็ก ยิงดาวเคราะห์น้อยและยานบินศัตรู

เกมนี้ เอา Free Source code มาจาก Unity แล้วมาทำลง Android
https://www.assetstore.unity3d.com/#/content/13866 

วิธีการเล่น
สัมผัสที่จะยิงเลเซอร์
สัมผัสเพื่อย้ายไปทางซ้าย, ขวา, ขึ้น, ลง

More Android App on Google Play.