public static void BuildAssetBundles()
    {
        var outputPath = bundleBuildPath;

        if (!Directory.Exists(outputPath))
        {
            Directory.CreateDirectory(outputPath);
        }

        var results = CompileScripts();

        var settings = new BuildSettings();

        settings.target       = EditorUserBuildSettings.activeBuildTarget;
        settings.group        = EditorUserBuildSettings.selectedBuildTargetGroup;
        settings.typeDB       = results.typeDB;
        settings.outputFolder = outputPath;

        SetupAssetVariantMapsAsset();
        var input = BuildInterface.GenerateBuildInput();

        BuildInput addressableInput;

        AddressableAssetSettings.GetDefault().GenerateBuildInput(out addressableInput);

        //input = addressableInput.Merge(input);

        BuildCommandSet commands;

        if (AssetBundleBuildPipeline.GenerateCommandSet(settings, input, out commands))
        {
            BuildOutput output;
            if (AssetBundleBuildPipeline.ExecuteCommandSet(settings, commands, out output))
            {
                var bundlesToCopy = new List <string>(output.results.Select(x => x.assetBundleName));
                CopyBundlesToStreamingAssets(bundlesToCopy);

                CreateContentCatalog(commands);
            }
        }
    }
        public static void BuildAssetBundles()
        {
            var buildTimer = new Stopwatch();

            buildTimer.Start();

            var input       = BuildInterface.GenerateBuildInput();
            var settings    = GenerateBuildSettings();
            var compression = BuildCompression.DefaultUncompressed;

            // Rebuild sprite atlas cache for correct dependency calculation & writting
            Packer.RebuildAtlasCacheIfNeeded(settings.target, true, Packer.Execution.Normal);

            // Generate command set
            BuildCommandSet commands;
            var             packer = new Unity5Packer();

            if (!packer.Convert(input, settings.target, out commands))
            {
                return;
            }

            //DebugPrintCommandSet(ref commands);

            // Calculate dependencies
            BuildCommandSet depCommands;
            var             dependencyCalculator = new Unity5DependencyCalculator();

            if (!dependencyCalculator.Convert(commands, out depCommands))
            {
                return;
            }

            DebugPrintCommandSet(ref depCommands);

            // TODO: implement incremental building when LLAPI supports it

            // Write out resource files
            BuildOutput output;
            var         resourceWriter = new ResourceWriter();

            if (!resourceWriter.Convert(depCommands, settings, out output))
            {
                return;
            }

            // Archive and compress resource files
            uint[] crc;
            var    archiveWriter = new ArchiveWriter();

            if (!archiveWriter.Convert(output, compression, settings.outputFolder, out crc))
            {
                return;
            }

            // Generate Unity5 compatible manifest files
            string[] manifestfiles;
            var      manifestWriter = new Unity5ManifestWriter();

            if (!manifestWriter.Convert(depCommands, output, crc, settings.outputFolder, out manifestfiles))
            {
                return;
            }

            buildTimer.Stop();
            BuildLogger.Log("Build Asset Bundles complete in: {0:c}", buildTimer.Elapsed);
        }