版本:Unity 6 (6000.0)
语言英语
  • C#

BuildAssetBundleOptions.DryRunBuild

建议更改

成功!

感谢您帮助我们提高 Unity 文档的质量。尽管我们无法接受所有提交项,但我们确实会逐个阅读用户建议的更改,并在适用情况下进行更新。

关闭

提交失败

出于某些原因,您建议的更改无法提交。请在几分钟后<a>重试</a>。感谢您抽出时间来帮助我们提高 Unity 文档的质量。

关闭

取消

描述

执行空运行版本构建。

这允许您为 AssetBundles 执行空运行构建,但不会实际构建它们。启用此选项后,BuildPipeline.BuildAssetBundles 仍会返回一个 AssetBundleManifest 对象,其中包含有效的 AssetBundle 依赖项和哈希。

//Create a folder (right click in the Assets folder and go to Create>Folder), and name it “Editor” if it doesn’t already exist
//Place this script in the Editor folder

//This script creates a new Menu named “Build Asset” and new options within the menu named “Normal” and “Dry Run Build”. Click these menu items to build an AssetBundle into a folder.

using UnityEngine; using UnityEditor;

public class Example { //Creates a new menu (Build Asset Bundles) and item (Normal) in the Editor [MenuItem("Build Asset Bundles/Normal")] static void BuildABsNone() { //Build AssetBundles with no special options //They will be written in the custom folder ("MyAssetBuilds") which needs to exist prior to this call. BuildPipeline.BuildAssetBundles("Assets/MyAssetBuilds", BuildAssetBundleOptions.None, BuildTarget.StandaloneOSX); }

//Creates a new item (Dry Run Build) in the new Build Asset Bundles menu [MenuItem("Build Asset Bundles/Dry Run Build")] static void BuildABsDry() { //Build the AssetBundles in dry run build mode BuildPipeline.BuildAssetBundles("Assets/MyAssetBuilds", BuildAssetBundleOptions.DryRunBuild, BuildTarget.StandaloneOSX); } }