Unity打包Android平台AssetBundle脚本

志不强者智不达,言不信者行不果。这篇文章主要讲述Unity打包Android平台AssetBundle脚本相关的知识,希望能为你提供帮助。
注意,BuildTarget tagetPlatform参数为BuildTarget.Android

using UnityEngine; using UnityEditor; public class BuildAssetBundlesExample: MonoBehaviour { [MenuItem("Example/Build Asset Bundles")] static void BuildABs() { // Put the bundles in a folder called "ABs" within the Assets folder. BuildPipeline.BuildAssetBundles("Assets/ABs", BuildAssetBundleOptions.None, BuildTarget.android); } }

  BuildTarget 编译目标类型:Enumeration
Target build platform.
目标编译平台。
Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor; " at the beginning of the script.
注意:这是一个编辑器类,如果想使用它你需要把它放到工程目录下的Assets/Editor文件夹下。编辑器类在UnityEditor命名空间下。所以当使用C#脚本时,你需要在脚本前面加上 "using UnityEditor"引用。
参见:  BuildPipeline.BuildPlayer.
Values值
    • WebPlayer Build a web player. // 编译一个网络播放器。
    • WebPlayerStreamed Build a streamed web player. // 编译一个流播放器。
    • DashboardWidget Build an OS X Dashboard widget.
      编译一个OS X Dashboard widget(仪表板小工具)。
    • StandaloneOSXUniversal Build an OS X standalone. // 编译一个OS X 独立版。
    • StandaloneOSXPPC Build an OS X standalone (PowerPC only).
      编译一个OS X 独立版(仅PowerPC处理器)。
    • StandaloneOSXIntel Build an OS X standalone (Intel only).
      编译一个OS X 独立版(仅Intel处理器)。
    • StandaloneWindows Build a Windows standalone. // 编译一个Windows独立版。
    • iPhone Build an iPhone player // 编译一个iPhone播放器。
    • PS3 Build a PS3 Standalone // 编译一个PS3独立版。
    • XBOX360 Build a XBox Standalone // 编译一个XBox独立版。
    • Android Build an Android .apk standalone app
      编译一个安卓.apk独立版应用。
    • Wii Build a Wii standalone // 编译一个Wii独立版。
    • StandaloneWindows64 Build a Windows 64-bit standalone. // 编译Windows独立版64位。
【Unity打包Android平台AssetBundle脚本】

    推荐阅读