-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathBuildManager.cs
More file actions
75 lines (54 loc) · 2.03 KB
/
BuildManager.cs
File metadata and controls
75 lines (54 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System.Diagnostics;
using UnityEditor;
using UnityEngine;
public class BuildManager {
private const string WIN_FOLDER_PATH = "/../Builds/Windows/Evolution.exe";
private const string MACOS_FOLDER_PATH = "/../Builds/Mac/Evolution.app";
private const string LINUX_EXPORT_PATH = "/../Builds/Linux/Evolution.x86_64";
private const string WEBGL_EXPORT_PATH = "/../Builds/WebGL/Evolution";
[MenuItem("BuildTools/Build All Standalones")]
public static void BuildAllStandalones() {
BuildMacOS();
BuildWindows();
BuildLinux();
BuildWebGL();
}
[MenuItem("BuildTools/Build All Except WebGL")]
public static void BuildAllExceptWebGL() {
BuildMacOS();
BuildWindows();
BuildLinux();
}
[MenuItem("BuildTools/Build Windows")]
public static void BuildWindows() {
var path = Application.dataPath + WIN_FOLDER_PATH;
Build(BuildTarget.StandaloneWindows, BuildOptions.CompressWithLz4HC, path);
}
[MenuItem("BuildTools/Build macOS")]
public static void BuildMacOS() {
var path = Application.dataPath + MACOS_FOLDER_PATH;
//UnityEngine.Debug.Log("Path = " + path);
Build(BuildTarget.StandaloneOSX, BuildOptions.ShowBuiltPlayer | BuildOptions.CompressWithLz4HC, path);
}
[MenuItem("BuildTools/Build Linux")]
public static void BuildLinux() {
var path = Application.dataPath + LINUX_EXPORT_PATH;
Build(BuildTarget.StandaloneLinux64, BuildOptions.CompressWithLz4HC, path);
}
[MenuItem("BuildTools/Build WebGL")]
public static void BuildWebGL() {
var path = Application.dataPath + WEBGL_EXPORT_PATH;
Build(BuildTarget.WebGL, BuildOptions.CompressWithLz4HC, path);
}
private static void Build(BuildTarget target, BuildOptions options, string path) {
var buildPlayerOptions = new BuildPlayerOptions();
buildPlayerOptions.locationPathName = path;
buildPlayerOptions.scenes = new string[] {
"Assets/Scenes/CreatureBuildingScene.unity",
"Assets/Scenes/EvolutionScene.unity"
};
buildPlayerOptions.options = options;
buildPlayerOptions.target = target;
BuildPipeline.BuildPlayer(buildPlayerOptions);
}
}