Add ci.
This commit is contained in:
parent
795933f789
commit
5f7a915438
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4feeb981ea509cd42967c3637667453d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,72 @@
|
|||
#if UNITY_EDITOR
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Build;
|
||||
using UnityEditor.Build.Reporting;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
|
||||
public static class BuilderTool
|
||||
{
|
||||
public static NamedBuildTarget GetBuildTarget() => NamedBuildTarget.Standalone;
|
||||
|
||||
[MenuItem("Builds/Build")]
|
||||
public static void Build()
|
||||
{
|
||||
var productName = $"VR Project 3";
|
||||
var rootPath = Application.dataPath + "/../";
|
||||
var bundleNumber = PlayerSettings.Android.bundleVersionCode;
|
||||
bundleNumber++;
|
||||
var buildRootPath = Path.Combine(rootPath, "Builds2");
|
||||
var buildName = $"{productName}.exe";
|
||||
var buildPlayerOptions = new BuildPlayerOptions();
|
||||
|
||||
var defines = GetActualDefines();
|
||||
ApplyDefines(defines);
|
||||
|
||||
|
||||
PlayerSettings.applicationIdentifier = $"com.BoggArt.OscSender.{productName}";
|
||||
PlayerSettings.productName = productName;
|
||||
buildPlayerOptions.scenes = GetScenes();
|
||||
buildPlayerOptions.locationPathName = Path.Combine(buildRootPath, buildName);
|
||||
buildPlayerOptions.target = BuildTarget.StandaloneWindows64;
|
||||
buildPlayerOptions.options = BuildOptions.None;
|
||||
buildPlayerOptions.extraScriptingDefines = defines;
|
||||
|
||||
if (!Directory.Exists(buildRootPath))
|
||||
Directory.CreateDirectory(buildRootPath);
|
||||
|
||||
BuildReport report = BuildPipeline.BuildPlayer(buildPlayerOptions);
|
||||
BuildSummary summary = report.summary;
|
||||
|
||||
if (summary.result == BuildResult.Succeeded)
|
||||
{
|
||||
Debug.Log("Build succeeded: " + summary.totalSize + " bytes");
|
||||
}
|
||||
|
||||
if (summary.result == BuildResult.Failed)
|
||||
{
|
||||
Debug.Log("Build failed");
|
||||
}
|
||||
}
|
||||
|
||||
public static string[] GetActualDefines()
|
||||
{
|
||||
return PlayerSettings.GetScriptingDefineSymbols(GetBuildTarget()).Split(";").ToArray();
|
||||
}
|
||||
|
||||
public static string[] GetScenes()
|
||||
{
|
||||
return EditorBuildSettings.scenes.Select(s => s.path).ToArray();
|
||||
}
|
||||
|
||||
private static void ApplyDefines(string[] defines)
|
||||
{
|
||||
PlayerSettings.SetScriptingDefineSymbols(GetBuildTarget(), defines);
|
||||
}
|
||||
}
|
||||
#endif
|
Loading…
Reference in New Issue