Skip to content

Commit

Permalink
feat: build configurator added
Browse files Browse the repository at this point in the history
  • Loading branch information
stan-osipov committed Aug 25, 2020
1 parent a9790c1 commit 9713b23
Show file tree
Hide file tree
Showing 34 changed files with 646 additions and 63 deletions.
8 changes: 8 additions & 0 deletions com.stansassets.scene-management/BuildConfigurator.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using UnityEditor;

namespace StansAssets.SceneManagement.Build
{
[Serializable]
public class BuildConfiguration
{
public string Name = string.Empty;
public bool DefaultScenesFirst = false;
public List<SceneAsset> DefaultScenes = new List<SceneAsset>();
public List<PlatformsConfiguration> Platforms = new List<PlatformsConfiguration>();

public bool IsEmpty => DefaultScenes.Count == 0 && Platforms.Count == 0;

public BuildConfiguration Copy()
{
var copy = new BuildConfiguration();
copy.Name = Name + " Copy";
foreach (var scene in DefaultScenes)
{
copy.DefaultScenes.Add(scene);
}

foreach (var platformsConfiguration in Platforms)
{
var p = new PlatformsConfiguration();
foreach (var target in platformsConfiguration.BuildTargets)
{
p.BuildTargets.Add(target);
}

foreach (var scene in platformsConfiguration.Scenes)
{
p.Scenes.Add(scene);
}

copy.Platforms.Add(p);
}

return copy;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using UnityEditor;

namespace StansAssets.SceneManagement.Build
{
public static class BuildConfigurationMenu
{
[MenuItem(SceneManagementPackage.RootMenu + "Build Settings", false, 1)]
public static void OpenBuildSettings() {
BuildConfigurationWindow.ShowTowardsInspector("Build Conf");
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Collections.Generic;
using StansAssets.Plugins;

namespace StansAssets.SceneManagement.Build {

public class BuildConfigurationSettings : PackageScriptableSettingsSingleton<BuildConfigurationSettings>
{
protected override bool IsEditorOnly => true;
public override string PackageName => SceneManagementPackage.PackageName;


public int ActiveConfigurationIndex = 0;
public List<BuildConfiguration> BuildConfigurations = new List<BuildConfiguration>();

public BuildConfiguration Configuration => ActiveConfigurationIndex >= BuildConfigurations.Count
? new BuildConfiguration()
: BuildConfigurations[ActiveConfigurationIndex];
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9713b23

Please sign in to comment.