Some scripts to simplify setting up a Unity build.
- Open your Unity Project
- Import this package: Windows -> PackageManager -> +โพ -> "Import package from git url..."
- Click Assets -> Create -> Build -> "Create BuildConfig"
- Name the config appropriately
- create a new File "Editor/BuildMenu.cs"
using System;
using System.Linq;
using UnityEditor;
using BuildConfig;
namespace SampleNamespace
{
public static class BuildMenu
{
[MenuItem("Build/<Name your build here>")]
public static void NameOfYourBuildMethod()
{
var buildConfigGuid =
AssetDatabase.FindAssets("<Put your buildconfig here (without the .asset extension)>").SingleOrDefault()
?? throw new InvalidOperationException("BuildConfiguration not found");
var buildConfigPath = AssetDatabase.GUIDToAssetPath(buildConfigGuid);
var buildConfig = AssetDatabase.LoadAssetAtPath<BuildConfiguration>(buildConfigPath);
Build.BuildWithConfig(buildConfig);
}
}
}