Set assets to be in a bundle in editor asset bundle

Issue #43 resolved
Matt D created an issue

I think that every asset included as a main asset within an asset bundle should have it set via AGBT https://docs.unity3d.com/ScriptReference/AssetImporter-assetBundleName.html This means that during testing in the editor https://docs.unity3d.com/ScriptReference/AssetDatabase.GetAssetPathsFromAssetBundleAndAssetName.html can be used to load assets without having to re-build the bundles. Could AGBT automatically set the Asset importer's asset bundle name to the name of the asset bundle?

Comments (6)

  1. Hiroki Omae

    assetBundleName does not need to be set because ABGT does not use that data, and by design it avoids setting it.

    however, I see the use of AssetDatabase.GetAssetPathsFromAssetBundleAndAssetName() during development.

    It will be an alternative way than built-in feature, but I will create a way to access this.

    One note, the ongoing current development of AssetBundle in Unity is in direction to redefine how to access assets during development. This redefines features such as AssetDatabase.GetAssetPathsFromAssetBundleAndAssetName(). Once those features are landed, what ABGT will do here should be merged smoothly into editor's default feature set.

  2. Hiroki Omae

    Solved in dev branch. Instead of setting asset bundle names, you can get asset paths from:

    UnityEngine.AssetBundles.GraphTool.AssetBundleBuildMap.GetAssetPathsFromAssetBundleAndAssetName()

    This will allow you to implement simulation mode with graph tools.

  3. Felipe Teixeira Moraes

    To anyone that lands here like me, trying to find a solution to use Asset Bundle Manager Simulated Mode and Asset Graph, here is the latest implementation as of today:

    var assetBundleBuildMap = UnityEngine.AssetGraph.AssetBundleBuildMap.GetBuildMap();
    var levelPaths = assetBundleBuildMap.GetAssetPathsFromAssetBundleAndAssetName(assetBundleName, levelName);
    

    Just assign "UnityEngine.AssetGraph.AssetBundleBuildMap.GetBuildMap" to a local variable and then get "GetAssetPathsFromAssetBundleAndAssetName(assetBundleName, assetName)" out of it. Easy as that.

  4. Log in to comment