Click here to Skip to main content
15,745,750 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello guys.

I'm trying Asset Bundle Build via command line and i can do. With this code:

Object[] selectedAssets = Resources.LoadAll<GameObject>("Prefabs");
        Object[] videos = Resources.LoadAll<VideoClip>("Prefabs");
        Object obje = new Object();
        List<Object[]> list = new List<Object[]>();
        List<Object[]> listVideo = new List<Object[]>();
        for (int i = 0; i < selectedAssets.Length; i++)
            list.Add(new Object[1]);
            list[i][0] = selectedAssets[i];
        for (int i = 0; i < list.Count; i++)
            BuildPipeline.BuildAssetBundle(obje, list[i], bundlePath + list[i][0].name, BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets  , BuildTarget.Android );
        for (int i = 0; i < videos.Length; i++)
            listVideo.Add(new Object[1]);
            listVideo[i][0] = videos[i];
        for (int i = 0; i < listVideo.Count; i++)
            BuildPipeline.BuildAssetBundle(obje, listVideo[i], bundlePath + listVideo[i][0].name, BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets , BuildTarget.Android);

when i am trying in Unity Editor, original file is 19.255 mb , output file is 7.623 mb.
if i try with command line with this code:

C:\Program Files\Unity\Editor\Unity.exe" -batchmode -createProject "Project Path" -quit

this for creating project.


"C:\Program Files\Unity\Editor\Unity.exe" -batchmode -projectPath "Project Path" -executeMethod CreateAssetBundle.ExportBundle -quit

this executing ExportBundle.

Before output file become 17.989mb.

How may i compressed like open and manuel execute ExportBundle with Command Line?

Sorry my english.

What I have tried:

When i'm traying BuildAssetBundleOptions.ChunkBasedCompression this time become 34.627 mb.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900