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

BuildAssetBundleOptions.StrictMode

建议修改

成功!

感谢你为我们提高 Unity 文档的质量提供帮助。尽管我们无法接受全部提交,但我们会阅读用户提出的每项建议的修改,并在合适的地方更新。

关闭

提交失败

由于某些原因,你的建议修改未能提交。请<a>重试</a>。感谢你花时间帮助我们提高 Unity 文档的质量。

关闭

取消

说明

如果在编译过程中报告任何错误,则不允许编译成功。

如果不使用该标志,则非致命错误(例如无法为特定平台编译着色器)不会导致编译失败,但可能导致运行时行为不正确。

//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 “Strict Mode”. Click these menu items to build an AssetBundle into a folder with either no extra build options, or a strict build.

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 (Strict Mode) in the new Build Asset Bundles menu [MenuItem("Build Asset Bundles/Strict Mode")] static void BuildABsStrict() { //Build the AssetBundles in strict mode (build fails if any errors are detected) BuildPipeline.BuildAssetBundles("Assets/MyAssetBuilds", BuildAssetBundleOptions.StrictMode, BuildTarget.StandaloneOSX); } }