Tuesday, June 11, 2013

Unity3D on Android

When porting a unity3d game to Android, one of the main issues is textures.

Symptoms:
Textures are completely black - so you see a black screen instead of the default unity`s blue, and textured meshes seem invisible.
Or textures are almost completely grey

Solution:
1. Create multiple APK`s. each uses the right compression.  For example HTC-Desire HD phone has a Qualcomm snapdragon GPU which supports "ATC" compression.
This step is only in the build (few separate builds)

2. On some devices, this will still not solve the problem. In that case, on the texture import settings, on "Texture Type" choose "Texture" instead of "Advanced"  and Format="Compressed".
On the build-settings, choose "Don`t override".





Override for Android and textures (from here)
ETC supported by all, but no alpha, which is very important for games.
DXT supported by Tegra.   [Asus-transformer]
PVRTC support by Imagination PowerVR
ATC supported by Qualcomm snapdragon  [HTC-desire-HD]
RGBA 16 means 4096x4096=32MB
RGBA 32 is what will become of unsupported compression type per device (put DXT texture on non-tegra and it will expand to 4096x4096=64MB and take lot`s of memory!!!!)

Android Build (from here)
There is an option "Texture Compression". By default, Unity uses ETC1/RGBA16 texture format for textures that don't have individual texture format overrides.