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

BuildAssetBundleOptions.None

建议更改

成功!

感谢您帮助我们改善 Unity 文档的质量。虽然我们无法接受所有提交,但我们确实会阅读用户建议的每一处更改,并在适用时进行更新。

关闭

提交失败

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

关闭

取消

说明

不使用任何特殊选项构建 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 option 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); } }