BuildPipeline.BuildPlayer with AAB
I've tried moving the EditorUserBuildSettings round a bit, and settled on the IPreprocessBuildWithReport route, but not sure how necessary that is, rather than just adding it to the start of BuildAll
Anyway, either way, when I build manually using the menu, I get my AAB as expected, but when using this build command, it produces a folder called test.aab, containing a gradle android studio project - what am I doing wrong here - I just want the same behaviour as doing it manually from the menu.
Any help would be appreciated!
class BuildStepEnableBundle : IPreprocessBuildWithReport
{
public int callbackOrder { get { return 0; } }
public void OnPreprocessBuild(BuildReport report)
{
EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Gradle;
EditorUserBuildSettings.buildAppBundle = true;
}
}
public class BuildAll
{
[MenuItem("Game/Build/Build All")]
static void Build()
{
PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, ScriptingImplementation.IL2CPP);
BuildPipeline.BuildPlayer(scenes, "Build/Android/test.aab", BuildTarget.Android, BuildOptions.CompressWithLz4HC);
}
}
Your answer
Follow this Question
Related Questions
unity AAB + PAD method does not build. (android app) 0 Answers
Display problem after build to Anroid - SOLVED 2 Answers
when i click switch platform to Android, the unity program just crashed 1 Answer
Gradle build failed.See the console 1 Answer
Unity says that I'm missing my NDK and SDK libraries, but I have them installed via Unity hub? 1 Answer