Version: 2017.3
Method group is Obsolete

BuildPipeline.PushAssetDependencies

切换到手册
Obsolete public static void PushAssetDependencies ();

描述

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

如果一个资源包与其他资源包有依赖关系,那么您需要负责确保依赖的资源包通过 UnityWebRequest 类加载。

当您推送资源依赖关系时,它会在该层分享所有资源,递归推送始终会继承之前的依赖关系。 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

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961