12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using UnityEditor;
- using UnityEngine;
- namespace XRTool.Util
- {
- public class BuildInfo
- {
- /// <inheritdoc />
- public virtual BuildTarget BuildTarget { get; }
-
- private string outputDirectory;
- /// <inheritdoc />
- public IEnumerable<string> Scenes { get; set; }
- private const string EDITOR_PREF_BUILD_DIR = "BuildDeployWindow_BuildDir";
- private const string EDITOR_PREF_INCREMENT_BUILD_VERSION = "BuildDeployWindow_IncrementBuildVersion";
- public static string BuildDirectory
- {
- get => $"{EditorPreferences.Get(EDITOR_PREF_BUILD_DIR, "Builds")}/{EditorUserBuildSettings.activeBuildTarget}";
- set => EditorPreferences.Set(EDITOR_PREF_BUILD_DIR, value.Replace($"/{EditorUserBuildSettings.activeBuildTarget}", string.Empty));
- }
- public string OutputDirectory
- {
- get => string.IsNullOrEmpty(outputDirectory) ? outputDirectory = BuildDirectory : outputDirectory;
- set => outputDirectory = value;
- }
- /*
- //buildReport = BuildPipeline.BuildPlayer(
- // buildInfo.Scenes.ToArray(),
- // buildInfo.OutputDirectory,
- // buildInfo.BuildTarget,
- // buildInfo.BuildOptions);
- */
- public BuildInfo()
- {
- BuildTarget = EditorUserBuildSettings.activeBuildTarget;
- Scenes = EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(scene => scene.path);
- }
- }
- }
|