csharp BatchBuild.cs
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp BatchBuild.cs相关的知识,希望对你有一定的参考价值。
using UnityEngine;
using UnityEditor;
using System.Collections;
public class BatchBuild
{
static string bundleIdentifier = "jp.cellfusion.HogeHoge";
// シーンを Editor の設定から取り出す
private static string[] GetScenes ()
{
ArrayList levels = new ArrayList ();
foreach (EditorBuildSettingsScene scene in EditorBuildSettings.scenes) {
if (scene.enabled) {
levels.Add (scene.path);
}
}
return (string[])levels.ToArray (typeof(string));
}
[UnityEditor.MenuItem("Tools/Build Android")]
public static void BuildAndroid ()
{
EditorUserBuildSettings.SwitchActiveBuildTarget (BuildTarget.Android);
PlayerSettings.bundleIdentifier = bundleIdentifier;
//PlayerSettings.bundleVersion = bundleVersion;
PlayerSettings.statusBarHidden = true;
BuildPipeline.BuildPlayer(GetScenes(), "android.apk", BuildTarget.Android, BuildOptions.None);
}
[UnityEditor.MenuItem("Tools/Build iOS")]
public static void BuildiOS() {
EditorUserBuildSettings.SwitchActiveBuildTarget( BuildTarget.iPhone );
BuildOptions opt = BuildOptions.SymlinkLibraries | BuildOptions.AllowDebugging | BuildOptions.Development;
//BUILD for Device
PlayerSettings.iOS.sdkVersion = iOSSdkVersion.DeviceSDK;
PlayerSettings.iOS.targetOSVersion = iOSTargetOSVersion.iOS_6_0;
PlayerSettings.iOS.targetDevice = iOSTargetDevice.iPhoneAndiPad;
PlayerSettings.bundleIdentifier = bundleIdentifier;
//PlayerSettings.bundleVersion = bundleVersion;
PlayerSettings.statusBarHidden = true;
PlayerSettings.defaultInterfaceOrientation = UIOrientation.LandscapeRight;
string errorMsg_Device = BuildPipeline.BuildPlayer(GetScenes(), "iOS", BuildTarget.iPhone, opt);
if (string.IsNullOrEmpty(errorMsg_Device)){
} else {
//エラー処理適当に
}
}
[UnityEditor.MenuItem("Tools/Build Web")]
public static void BuildWebPlayer()
{
BuildOptions opt = BuildOptions.Development;
string errorMsg_Web = BuildPipeline.BuildPlayer(GetScenes(), "web", BuildTarget.WebPlayer, opt);
}
}
以上是关于csharp BatchBuild.cs的主要内容,如果未能解决你的问题,请参考以下文章
csharp 例如-CSHARP-GroupDocs.Conversion.Examples.CSharp - 程序 - ConvertFilesToDifferentFormats.cs
csharp 例如-CSHARP-GroupDocs.Conversion.Examples.CSharp渲染,RenderPSDImageAsPath.cs
csharp 实例-CSHARP-GroupDocs.Conversion.Examples.CSharp变频-ConvertTopresentationAsPath.cs
csharp 实例-CSHARP-GroupDocs.Conversion.Examples.CSharp变频-ConvertTopresentationAsPath.cs
csharp 实例-CSHARP-GroupDocs.Conversion.Examples.CSharp变频-ConvertTopresentationAsPath.cs
csharp 例如-CSHARP-GroupDocs.Search.Examples.CSharp索引,AddDocumentToIndex.cs