ScriptableBuildPipline behaves differently after moving to the Assets directory

Hello everyone, I encountered some problems while using ScriptableBuildPipline. Since I don’t want to modify my original code related to building AssetBundle, I want to modify some source code of ScriptableBuildPipline to adapt to my current build process, but when I move the ScriptableBuildPipline package After going to the Assets directory and using CompatibilityAssetBundleManifest.BuildAssetBundles, the asset name inside the AssetBundle is in lowercase. However, under PackageManager, the asset name is in all uppercase and lowercase letters. I haven’t even modified the source code, I just moved the position of ScriptableBuildPipline to make it easier for me. Edit, what happened?

public static void Test2()
{
    var options = BuildAssetBundleOptions.ChunkBasedCompression
              | BuildAssetBundleOptions.DisableLoadAssetByFileName
              | BuildAssetBundleOptions.ForceRebuildAssetBundle;

    var builds = new List<AssetBundleBuild>();

    var build = new AssetBundleBuild();
    build.assetBundleName = "Test.ab";
    build.assetNames = new string[] { "Assets/Res/map.png" };
    builds.Add(build);

    string tempDirectory = "Output";
    CompatibilityBuildPipeline.BuildAssetBundles(tempDirectory, builds.ToArray(), options, EditorUserBuildSettings.activeBuildTarget);

    AssetBundle ab = AssetBundle.LoadFromFile(tempDirectory + "/Test.ab");
    string[] names = ab.GetAllAssetNames();
    ab.Unload(true);

    for (int i = 0; i < names.Length; i++)
    {
        Debug.Log(names[i]);
    }
}

You’re not supposed to move packages to the Assets folder.

Follow the instructions in the below page.

1 Like