Search Unity

why BuildAssetBundle generate 4 files

Discussion in 'Scripting' started by RyanYN, Jun 6, 2018.

  1. RyanYN

    RyanYN

    Joined:
    Aug 13, 2013
    Posts:
    20
    hi,
    when i select a "cube.prefab" and run the script below, that'll generate 4 files("cube", "cube.manifest", "One", "One.manifest").
    i can load the cube transform from the "cube" bundle, even i delete the "cube.manifest, One, One.manifest", then why generate 4 files?
    can i put only the "cube" file to my server?
    Code (CSharp):
    1.     [MenuItem("Tool/GreatAllBundle")]
    2.     static void GreatAllBundle() {
    3.         AssetBundleBuild[] builds = new AssetBundleBuild[1];
    4.         Object[] selects = Selection.GetFiltered(typeof(Object),SelectionMode.DeepAssets);
    5.         string[] TestAsset = new string[selects.Length];
    6.         for (int i = 0; i < selects.Length; i++)
    7.         {
    8.             TestAsset[i] = AssetDatabase.GetAssetPath(selects[i]);
    9.             Debug.Log(TestAsset[i]);
    10.         }
    11.         builds[0].assetNames = TestAsset;
    12.         builds[0].assetBundleName = selects[0].name;
    13.         BuildPipeline.BuildAssetBundles(Application.streamingAssetsPath + "/One",builds, BuildAssetBundleOptions.None, BuildTarget.Android);
    14.         AssetDatabase.Refresh();
    15.     }
    macos unity2018.1.1f1

    thanks!
    lucky day~
     
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,188
    Well, looks like you're trying to build to "One" in that script, but honestly, just grab the asset bundle browser. You can set up your bundles in there, and build them from there as well.

    The .manifest files are just text files really that tells you a bit about the asset bundle. They aren't required for the server, but I believe you can use them for version control on the asset bundle.
     
  3. RyanYN

    RyanYN

    Joined:
    Aug 13, 2013
    Posts:
    20
    emmm..im trying build "cube", but there generated 4 files, so im so confused.
    in my opinion, there will only one "cube.bundle" file be generated.
     
  4. H000000

    H000000

    Joined:
    Oct 31, 2016
    Posts:
    1
    This "one" file stores descriptions of asset Bundle and information about asset Bundle dependencies。and if you want to plan your asset Bundle directory, you'll need it
     
  5. RyanYN

    RyanYN

    Joined:
    Aug 13, 2013
    Posts:
    20
    Get it! thanks!!