Method group is Obsolete

BuildPipeline.PushAssetDependencies

Switch to Manual
Obsolete public static void PushAssetDependencies ();

Description

允许您管理不同资源包和播放器构建之间的交叉引用和依赖关系。

If a asset bundle has dependencies to other asset bundles, it is your responsibility to make sure the dependent asset bundles are loaded through the WWW class.

当您推送资源依赖关系时,它会在该层分享所有资源,递归推送始终会继承之前的依赖关系。 PushAssetDependenciesPopAssetDependencies 必须互相持平。


@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.StandaloneWindows); BuildPipeline.PopAssetDependencies();

BuildPipeline.PopAssetDependencies(); }

请注意,5.4 及更高版本不支持 Web 播放器。

另请参阅:PopAssetDependenciesBuildAssetBundle