Last active
August 29, 2015 14:15
-
-
Save seaders/a277be987327f0d5d6e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using System; | |
using System.Collections.Generic; | |
public class GameBuilder | |
{ | |
static void Android() | |
{ | |
List<EditorBuildSettingsScene> scenes = new List<EditorBuildSettingsScene>(EditorBuildSettings.scenes); | |
List<string> enabledScenes = new List<string>(); | |
foreach (EditorBuildSettingsScene scene in scenes) | |
{ | |
// Console.WriteLine (scene.path); | |
if (scene.enabled) | |
{ | |
enabledScenes.Add(scene.path); | |
} | |
} | |
string[] buildScenes = enabledScenes.ToArray(); | |
// Console.WriteLine ("Building scenes " + buildScenes); | |
string[] destination = System.Environment.GetCommandLineArgs(); | |
PlayerSettings.keyaliasPass = "android"; | |
PlayerSettings.keystorePass = "android"; | |
BuildPipeline.BuildPlayer (buildScenes, destination[ destination.Length - 1 ], BuildTarget.Android, BuildOptions.None); | |
} | |
static void iOS() | |
{ | |
List<EditorBuildSettingsScene> scenes = new List<EditorBuildSettingsScene>(EditorBuildSettings.scenes); | |
List<string> enabledScenes = new List<string>(); | |
foreach (EditorBuildSettingsScene scene in scenes) | |
{ | |
if (scene.enabled) | |
{ | |
enabledScenes.Add(scene.path); | |
} | |
} | |
string[] buildScenes = enabledScenes.ToArray(); | |
// Console.WriteLine ("Building scenes " + buildScenes); | |
string[] destination = System.Environment.GetCommandLineArgs(); | |
// EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.iPhone); | |
BuildPipeline.BuildPlayer (buildScenes, destination[ destination.Length - 1 ], BuildTarget.iPhone, BuildOptions.None); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment