public static void Build(BuildConfig config, BuildTarget target) { Debug.Log("Build for " + target + " " + config.Env); config.Apply(target); Directory.CreateDirectory(Path.GetDirectoryName(config.LocationPathName)); var errorMessage = BuildPipeline.BuildPlayer( levels: EditorBuildSettings.scenes.Select(s => s.path).ToArray(), locationPathName: config.LocationPathName, target: config.Target, options: config.Options ); if (!string.IsNullOrEmpty(errorMessage)) { Debug.LogError(errorMessage); throw new UnityException(errorMessage); } }
/// PreBuild for UnityCloudBuild /// CloudBuildの設定から PreBuildを設定、DefineSymbolにenvを設定 /// Build自体はCloudBuilder.Builderが自動で行うので、Applyまでしておく public static void PreBuild() { Debug.Log("PreBuild"); BuildConfig config = null; #if DEV config = BuildConfig.Load("dev"); #else config = BuildConfig.Load("release"); #endif var target = BuildTarget.StandaloneOSXUniversal; #if UNITY_IOS target = BuildTarget.iOS; #elif UNITY_ANDROID target = BuildTarget.Android; #else target = BuildTarget.StandaloneOSXUniversal; #endif config.Apply(target); }