異なるアセットバンドルやプレイヤーの相互参照・依存関係を管理することができます
アセットバンドルが他のアセットバンドルと依存関係を持っている場合、依存するアセットバンドルが WWW クラスを通して読み込まれる事を確認してください。
アセットに属するものをプッシュすると、再帰的に属するものを継承しその階層のすべてのリソースを共有します。
PushAssetDependencies と PopAssetDependencies であっても、互いにプッシュアウトします。
@MenuItem("Assets/Auto Build Asset Bundles") static function ExportResource () {
// Enable cross-references for all following asset bundles files until // we call PopAssetDependencies BuildPipeline.PushAssetDependencies();
var options = BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets;
// All subsequent resources share assets in this asset bundles // It is up to you to ensure that the shared asset bundle is // loaded prior to loading other resources BuildPipeline.BuildAssetBundle( AssetDatabase.LoadMainAssetAtPath("assets/artwork/lerpzuv.tif"), null, "Shared.unity3d", options);
// By pushing and popping around the asset bundle, this file // will share resources but later asset bundles will not share assets in this resource BuildPipeline.PushAssetDependencies(); BuildPipeline.BuildAssetBundle( AssetDatabase.LoadMainAssetAtPath("Assets/Artwork/Lerpz.fbx"), null, "Lerpz.unity3d", options); BuildPipeline.PopAssetDependencies();
// By pushing and popping around the asset bundle, this file // will share resources but later asset bundles will not share assets in this resource BuildPipeline.PushAssetDependencies(); BuildPipeline.BuildAssetBundle( AssetDatabase.LoadMainAssetAtPath("Assets/Artwork/explosive guitex.prefab"), null, "explosive.unity3d", options); BuildPipeline.PopAssetDependencies();
// By pushing and popping around the asset bundle, this file // will share resources but later asset bundles will not share assets in this resource BuildPipeline.PushAssetDependencies(); BuildPipeline.BuildStreamedSceneAssetBundle( ["Assets/AdditiveScene.unity"], "AdditiveScene.unity3d", BuildTarget.WebPlayer); BuildPipeline.PopAssetDependencies(); BuildPipeline.PopAssetDependencies(); }
See Also: PopAssetDependencies, BuildAssetBundle.