superunitybuild / buildtool

A powerful automation tool for quickly and easily generating builds with Unity.
MIT License
1.21k stars 120 forks source link

Android build always has Texture Compression set to PVRTC #151

Open DmiShib opened 2 months ago

DmiShib commented 2 months ago

This issue started occurring when I upgraded to 'Unity 6 Preview.'

I investigated this matter and can pinpoint the cause:

BuildReport buildReport = BuildPipeline.BuildPlayer(new BuildPlayerOptions  
{  
    locationPathName = Path.Combine(buildPath, binName),  
    options = options,  
    scenes = releaseType.sceneList.GetActiveSceneFileList(),  
    target = architecture.target,  
    subtarget = (int)architecture.subtarget  
});
  1. For Android, the subtarget is an enum MobileTextureSubtarget.
  2. When creating BuildArchitecture for Android, we don’t pass the fifth argument, so the default parameter value is StandaloneBuildSubtarget.Player
  3. StandaloneBuildSubtarget.Player equals 2, meaning subtarget = 2, which corresponds to MobileTextureSubtarget.PVRTC

If you specify something like subtarget = (int)EditorUserBuildSettings.androidBuildSubtarget, it works correctly, but obviously, that’s not the solution. :)

DmiShib commented 2 months ago

I want to add that, as a result, there are consequences in Google Play Console: a 66% decrease in supported devices because the following is added to the AndroidManifest: GL_IMG_texture_compression_pvrtc

robinnorth commented 2 months ago

Thanks for the detailed report, @DmiShib! The build subtarget property for BuildArchitecture was a very recent addition to enable adding support for the Dedicated Server platform, so this is an unintended side-effect of that change. This functionality is still in development, so it hasn't yet been fully tested to catch issues like this – for now, try using the latest released version of SuperUnityBuild, v7.0.0, to avoid this problem.