├── .gitignore ├── Assets ├── BackgroundBuild │ ├── Editor │ │ ├── BackgroundBuildScript.cs │ │ ├── BackgroundBuildSettings.cs │ │ └── EditorResources │ │ │ ├── ToastIcon.png │ │ │ ├── bbuildwindowicon_dark.png │ │ │ ├── bbuildwindowicon_light.png │ │ │ └── snoretoast.exe │ └── Resources │ │ └── BackgroundBuildSettings.asset └── UnityBackgroundBuild.unitypackage ├── LICENSE ├── README.md └── Screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Everything: 2 | /* 3 | 4 | # And these file types: 5 | .DS_Store 6 | *.meta 7 | *.unity 8 | 9 | # Except for these: 10 | !/.gitignore 11 | !/Assets/ 12 | 13 | /Assets/Plugins/ 14 | !*.unitypackage 15 | !Screenshot.png 16 | -------------------------------------------------------------------------------- /Assets/BackgroundBuild/Editor/BackgroundBuildScript.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using System.Collections; 3 | using UnityEditor.Build.Reporting; 4 | using UnityEngine; 5 | using UnityEditor.Compilation; 6 | using System.IO; 7 | using System; 8 | 9 | public class BackgroundBuildScript : EditorWindow 10 | { 11 | BackgroundBuildSettings settings; 12 | bool currentlyCopying = false; 13 | static string pathToScript; 14 | 15 | string[] windowsBrowsers = new string[] { "chrome ", "firefox ", "microsoft-edge:", "iexplore ","Safari Not Available on Windows"}; 16 | string[] macBrowsers = new string[] { 17 | "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", 18 | "/Applications/Firefox.app/Contents/MacOS/firefox", 19 | "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge", 20 | "Internet Explore Not Available on Mac", 21 | "open" //safari works a little differently when opening from command line 22 | }; 23 | 24 | string logFilename = "Background-Build-Log.txt"; 25 | 26 | [MenuItem("Window/Background Build")] 27 | static void Init() 28 | { 29 | BackgroundBuildScript window = (BackgroundBuildScript)EditorWindow.GetWindow(typeof(BackgroundBuildScript)); 30 | GUIContent titleContent = new GUIContent ("BackgroundBuild", AssetDatabase.LoadAssetAtPath (pathToScript)); 31 | window.titleContent = titleContent; 32 | window.Show(); 33 | window.currentlyCopying = false; 34 | } 35 | 36 | void OnEnable() 37 | { 38 | LoadData(); 39 | } 40 | 41 | void OnDisable() 42 | { 43 | SaveData(); 44 | } 45 | 46 | // Data ================================================= 47 | 48 | void LoadData() 49 | { 50 | string dekstopPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop).Replace('\\','/'); 51 | string[] s = Application.dataPath.Split('/'); 52 | string projectName = s[s.Length - 2]; 53 | 54 | pathToScript = AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this)); 55 | 56 | string iconFilename = "bbuildwindowicon_light.png"; 57 | if (EditorGUIUtility.isProSkin) 58 | { 59 | iconFilename = "bbuildwindowicon_dark.png"; 60 | } 61 | 62 | pathToScript = pathToScript.Substring(0, pathToScript.LastIndexOf('/')) + "/EditorResources/" + iconFilename; 63 | 64 | settings = Resources.Load("BackgroundBuildSettings"); 65 | } 66 | 67 | 68 | void SaveData() 69 | { 70 | EditorUtility.SetDirty(settings); 71 | AssetDatabase.SaveAssets(); 72 | AssetDatabase.Refresh(); 73 | } 74 | 75 | // UI ================================================================ 76 | 77 | void OnGUI() 78 | { 79 | toolBarGUI(); 80 | 81 | GUIStyle guiStyle = new GUIStyle(); 82 | guiStyle.padding = new RectOffset( 10, 10, 10, 10 ); 83 | 84 | EditorGUILayout.BeginVertical(guiStyle); 85 | buildSettingsGUI(); 86 | launchSettingsGUI(); 87 | logSettingsGUI(); 88 | buildButtonGUI(); 89 | EditorGUILayout.EndVertical(); 90 | } 91 | 92 | void toolBarGUI() 93 | { 94 | GUILayout.BeginHorizontal(EditorStyles.toolbar); 95 | GUILayout.FlexibleSpace(); 96 | if (GUILayout.Button("Settings...", EditorStyles.toolbarButton)) { 97 | GenericMenu toolsMenu = new GenericMenu(); 98 | toolsMenu.AddItem(new GUIContent("Reset Settings"), false, doReset); 99 | toolsMenu.AddSeparator(""); 100 | toolsMenu.AddItem(new GUIContent("Help..."), false, showHelp); 101 | toolsMenu.DropDown(new Rect(Screen.width - 130 - 40, 0, 0, 16)); 102 | EditorGUIUtility.ExitGUI(); 103 | } 104 | GUILayout.EndHorizontal(); 105 | } 106 | 107 | void buildSettingsGUI() 108 | { 109 | GUILayout.Label( "Build Settings" , EditorStyles.boldLabel ); 110 | EditorGUI.indentLevel++; 111 | settings.buildTargetSelected = (BuildTarget)EditorGUILayout.EnumPopup("Build Target", settings.buildTargetSelected); 112 | 113 | EditorGUILayout.BeginHorizontal(); 114 | EditorGUILayout.TextField("Temporary Folder",settings.temporaryFolderPath,GUILayout.ExpandWidth(true)); 115 | if(GUILayout.Button("Browse",GUILayout.ExpandWidth(false))) 116 | settings.temporaryFolderPath = EditorUtility.SaveFolderPanel("Temporary Folder Path",settings.temporaryFolderPath,null) + "/temp"; 117 | EditorGUILayout.EndHorizontal(); 118 | 119 | EditorGUILayout.BeginHorizontal(); 120 | EditorGUILayout.TextField("Build Folder",settings.buildFolderPath,GUILayout.ExpandWidth(true)); 121 | if(GUILayout.Button("Browse",GUILayout.ExpandWidth(false))) 122 | settings.buildFolderPath = EditorUtility.SaveFolderPanel("Build Folder Path",settings.buildFolderPath,null) + "/build"; 123 | EditorGUILayout.EndHorizontal(); 124 | 125 | settings.showNotifications = EditorGUILayout.Toggle("Show Notifications",settings.showNotifications); 126 | settings.silentBuild = EditorGUILayout.Toggle("Silent Build",settings.silentBuild); 127 | } 128 | 129 | void launchSettingsGUI() 130 | { 131 | if ((settings.buildTargetSelected==BuildTarget.WebGL) || 132 | (settings.buildTargetSelected==BuildTarget.StandaloneOSX) || 133 | (settings.buildTargetSelected==BuildTarget.StandaloneWindows) || 134 | (settings.buildTargetSelected==BuildTarget.StandaloneWindows64) || 135 | (settings.buildTargetSelected==BuildTarget.StandaloneLinux64)) 136 | { 137 | 138 | GUILayout.Space(10); 139 | GUILayout.Label( "Launch Settings" , EditorStyles.boldLabel ); 140 | 141 | settings.launchBuild = EditorGUILayout.Toggle("Launch Build", settings.launchBuild); 142 | 143 | if (settings.buildTargetSelected==BuildTarget.WebGL) 144 | { 145 | EditorGUI.BeginDisabledGroup(settings.launchBuild == false); 146 | 147 | settings.customServer = EditorGUILayout.Toggle("Custom Server", settings.customServer); 148 | 149 | EditorGUI.BeginDisabledGroup(settings.customServer == false); 150 | settings.browser = (BackgroundBuildSettings.Browsers)EditorGUILayout.EnumPopup("Browser", settings.browser); 151 | settings.webGLURL = EditorGUILayout.TextField("WebGL URL",settings.webGLURL,GUILayout.ExpandWidth(true)); 152 | EditorGUI.EndDisabledGroup(); 153 | EditorGUI.EndDisabledGroup(); 154 | } 155 | } 156 | } 157 | 158 | void logSettingsGUI() 159 | { 160 | GUILayout.Space(10); 161 | GUILayout.Label( "Log Settings" , EditorStyles.boldLabel ); 162 | settings.logBuild = EditorGUILayout.Toggle("Log Build", settings.logBuild); 163 | EditorGUI.BeginDisabledGroup(settings.logBuild == false); 164 | EditorGUILayout.BeginHorizontal(); 165 | EditorGUILayout.TextField("Log Folder",settings.logFolderPath,GUILayout.ExpandWidth(true)); 166 | if(GUILayout.Button("Browse",GUILayout.ExpandWidth(false))) 167 | settings.logFolderPath = EditorUtility.SaveFolderPanel("Log Folder Path",settings.logFolderPath,null) + "/log"; 168 | EditorGUILayout.EndHorizontal(); 169 | 170 | settings.showLog = EditorGUILayout.Toggle("Show Log",settings.showLog); 171 | EditorGUI.EndDisabledGroup(); 172 | } 173 | 174 | void buildButtonGUI() 175 | { 176 | GUILayout.Space(10); 177 | EditorGUI.BeginDisabledGroup(currentlyCopying == true); 178 | if (GUILayout.Button("BUILD!", GUILayout.Height(40))) 179 | { 180 | currentlyCopying = true; 181 | SaveData(); 182 | PerformCopyAndInitSilentUnity(); 183 | } 184 | EditorGUI.EndDisabledGroup(); 185 | 186 | } 187 | 188 | // Settings Menu ================================================== 189 | 190 | void doReset() 191 | { 192 | currentlyCopying = false; 193 | settings.reset(); 194 | SaveData(); 195 | LoadData(); 196 | } 197 | 198 | void showHelp() 199 | { 200 | Application.OpenURL("https://github.com/RelativeDistance/UnityBackgroundBuild"); 201 | } 202 | 203 | // BUILD =========================================================== 204 | 205 | void PerformCopyAndInitSilentUnity() 206 | { 207 | 208 | if (settings.showNotifications) 209 | showNotification("Unity Build", "Copy Started"); 210 | 211 | if (settings.logBuild) 212 | { 213 | Directory.CreateDirectory(settings.logFolderPath); 214 | writeToLog("---------------------------------------",settings.logFolderPath); 215 | writeToLog("Copy Started",settings.logFolderPath); 216 | } 217 | 218 | FileUtil.DeleteFileOrDirectory( settings.temporaryFolderPath ); 219 | Directory.CreateDirectory(settings.temporaryFolderPath); 220 | 221 | FileUtil.ReplaceDirectory(System.IO.Directory.GetCurrentDirectory()+"/Assets", settings.temporaryFolderPath+"/Assets" ); 222 | FileUtil.ReplaceDirectory(System.IO.Directory.GetCurrentDirectory()+"/Library", settings.temporaryFolderPath+"/Library" ); 223 | FileUtil.ReplaceDirectory(System.IO.Directory.GetCurrentDirectory()+"/Packages", settings.temporaryFolderPath+"/Packages" ); 224 | FileUtil.ReplaceDirectory(System.IO.Directory.GetCurrentDirectory()+"/ProjectSettings", settings.temporaryFolderPath+"/ProjectSettings" ); 225 | currentlyCopying = false; 226 | 227 | string cmdLineParams = "-projectPath "; 228 | 229 | if (settings.silentBuild) 230 | { 231 | cmdLineParams = "-quit -batchmode " + cmdLineParams; 232 | } 233 | 234 | string unityPath = EditorApplication.applicationPath; 235 | 236 | #if UNITY_EDITOR_OSX 237 | unityPath += "/Contents/MacOS/Unity"; 238 | #endif 239 | 240 | doProcess(unityPath, cmdLineParams + "\"" +settings.temporaryFolderPath + "\" -executeMethod BackgroundBuildScript.PerformBuild"); 241 | } 242 | 243 | static void PerformBuild() 244 | { 245 | BackgroundBuildScript bbs = BackgroundBuildScript.CreateInstance("BackgroundBuildScript") as BackgroundBuildScript; 246 | 247 | bbs.LoadData(); 248 | bbs.OnEnable(); 249 | 250 | if (bbs.settings.showNotifications) bbs.showNotification("Unity Build", "Build Started"); 251 | 252 | if (bbs.settings.logBuild) bbs.writeToLog("Build Started",bbs.settings.logFolderPath); 253 | 254 | BuildOptions buildOptions = BuildOptions.None; 255 | 256 | if ((bbs.settings.launchBuild && (!(bbs.settings.buildTargetSelected==BuildTarget.WebGL))) 257 | || (!bbs.settings.customServer && bbs.settings.buildTargetSelected==BuildTarget.WebGL)) 258 | { 259 | buildOptions = BuildOptions.AutoRunPlayer; 260 | } 261 | 262 | string productName = Application.productName; 263 | 264 | #if UNITY_EDITOR_WIN 265 | if ((bbs.settings.buildTargetSelected == BuildTarget.StandaloneWindows) || (bbs.settings.buildTargetSelected == BuildTarget.StandaloneWindows64)) 266 | productName = productName + ".exe"; 267 | #endif 268 | 269 | BuildReport report = BuildPipeline.BuildPlayer(EditorBuildSettings.scenes, bbs.settings.buildFolderPath+"/"+productName , bbs.settings.buildTargetSelected, buildOptions); 270 | 271 | if (bbs.settings.launchBuild && bbs.settings.customServer && bbs.settings.buildTargetSelected==BuildTarget.WebGL) 272 | { 273 | bbs.launchBrowserForWebGLBuild(); 274 | } 275 | 276 | if ((bbs.settings.launchBuild) && !(bbs.settings.buildTargetSelected==BuildTarget.WebGL)) 277 | { 278 | if (bbs.settings.buildTargetSelected==BuildTarget.StandaloneOSX) 279 | { 280 | bbs.doProcess(bbs.settings.buildFolderPath+"/"+Application.productName+".app", null); 281 | } 282 | else if (bbs.settings.buildTargetSelected==BuildTarget.StandaloneWindows) 283 | { 284 | bbs.doProcess(bbs.settings.buildFolderPath+"/"+Application.productName+".exe", null); 285 | } 286 | } 287 | 288 | 289 | 290 | if (bbs.settings.showNotifications) 291 | { 292 | string message = ""; 293 | if (report.summary.result == BuildResult.Succeeded) 294 | { 295 | message = "BUILD SUCCEEDED - Total build time: " + report.summary.totalTime; 296 | } 297 | else if (report.summary.result == BuildResult.Failed) 298 | { 299 | message ="BUILD FAILED - Total build time: " + report.summary.totalTime; 300 | } 301 | 302 | bbs.showNotification("Unity Build", message ); 303 | if (bbs.settings.logBuild) bbs.writeToLog(message,bbs.settings.logFolderPath); 304 | } 305 | 306 | if (bbs.settings.showLog) 307 | { 308 | bbs.displayLog(bbs.settings.logFolderPath); 309 | } 310 | } 311 | 312 | public void showNotification(string windowTitle, string notificationMessage) 313 | { 314 | string notificationProgram,notification; 315 | 316 | #if UNITY_EDITOR_OSX 317 | notificationProgram = "osascript"; 318 | notification = string.Format ("-e 'display notification \"{0}\" with title \"{1}\"'" , notificationMessage ,windowTitle); 319 | #else 320 | notificationProgram = Application.dataPath.Replace("/Assets","") + "/" +pathToScript.Substring(0, pathToScript.LastIndexOf('/')) + "/snoretoast.exe"; 321 | string iconPath = Application.dataPath.Replace("/Assets","") + "/" +pathToScript.Substring(0, pathToScript.LastIndexOf('/'))+"/ToastIcon.png"; 322 | notification = string.Format ("-t \"{0}\" -m \"{1}\" -silent -p \"{2}\" -appID Snore.DesktopToasts.0.7.0" , notificationMessage ,windowTitle, iconPath ); 323 | #endif 324 | doProcess(notificationProgram, notification); 325 | } 326 | 327 | public void launchBrowserForWebGLBuild() 328 | { 329 | string browserLocation; 330 | string url = settings.webGLURL; 331 | #if UNITY_EDITOR_OSX 332 | browserLocation = macBrowsers[(int)settings.browser]; 333 | 334 | if (settings.browser==BackgroundBuildSettings.Browsers.Safari) 335 | { 336 | url = "-a Safari "+url; 337 | } 338 | 339 | doProcess(browserLocation, settings.webGLURL); 340 | 341 | #else 342 | browserLocation = windowsBrowsers[(int)settings.browser]; 343 | doProcess("cmd.exe", "/C start "+browserLocation + settings.webGLURL); 344 | #endif 345 | 346 | } 347 | 348 | void doProcess(string fileName, string arguments) 349 | { 350 | System.Diagnostics.Process p = new System.Diagnostics.Process(); 351 | p.StartInfo.FileName = fileName; 352 | p.StartInfo.Arguments = arguments; 353 | p.Start(); 354 | } 355 | 356 | void writeToLog(string line, string path) 357 | { 358 | StreamWriter writer = new StreamWriter(path+"/"+logFilename, true); 359 | writer.WriteLine(DateTime.Now +" " +line); 360 | writer.Close(); 361 | } 362 | 363 | public void displayLog(string path) 364 | { 365 | #if UNITY_EDITOR_OSX 366 | doProcess("open", "\""+path+"/"+logFilename+"\""); 367 | #else 368 | doProcess("cmd.exe", "/C \""+path+"/"+logFilename+"\""); 369 | #endif 370 | } 371 | 372 | 373 | } 374 | -------------------------------------------------------------------------------- /Assets/BackgroundBuild/Editor/BackgroundBuildSettings.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using System.Collections; 3 | using UnityEditor.Build.Reporting; 4 | using UnityEngine; 5 | using UnityEditor.Compilation; 6 | using System.IO; 7 | 8 | [CreateAssetMenu(fileName = "BackgroundBuildSettings", menuName = "BackgroundBuild/BackgroundBuildSettings")] 9 | public class BackgroundBuildSettings : ScriptableObject 10 | { 11 | public enum Browsers { Chrome, Firefox, Edge, InternetExplorer, Safari } 12 | 13 | public BuildTarget buildTargetSelected = BuildTarget.WebGL; 14 | public bool showNotifications = true; 15 | public bool silentBuild = true; 16 | public bool launchBuild = true; 17 | public bool customServer = false; 18 | public bool logBuild = false; 19 | public bool showLog = false; 20 | public string temporaryFolderPath,buildFolderPath,logFolderPath; 21 | public string webGLURL = "http://127.0.0.1/"; 22 | public Browsers browser = Browsers.Chrome; 23 | 24 | void OnEnable() 25 | { 26 | init(); 27 | } 28 | 29 | void init() 30 | { 31 | string desktopPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop).Replace('\\','/'); 32 | string[] s = Application.dataPath.Split('/'); 33 | string projectName = s[s.Length - 2]; 34 | if (string.IsNullOrEmpty(temporaryFolderPath)){ temporaryFolderPath = desktopPath + "/_" + projectName + "/temp"; } 35 | if (string.IsNullOrEmpty(buildFolderPath)){ buildFolderPath = desktopPath + "/_" + projectName + "/build"; } 36 | if (string.IsNullOrEmpty(logFolderPath)){ logFolderPath = desktopPath + "/_" + projectName + "/log";} 37 | } 38 | 39 | public void reset() 40 | { 41 | buildTargetSelected = BuildTarget.WebGL; 42 | showNotifications = true; 43 | launchBuild = true; 44 | customServer = false; 45 | logBuild = false; 46 | showLog = false; 47 | silentBuild = true; 48 | temporaryFolderPath = null; 49 | buildFolderPath=null; 50 | logFolderPath = null; 51 | webGLURL = "http://127.0.0.1/"; 52 | browser = Browsers.Chrome; 53 | init(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Assets/BackgroundBuild/Editor/EditorResources/ToastIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RelativeDistance/UnityBackgroundBuild/a54dfa8938b52b16e858d98e3839318509051574/Assets/BackgroundBuild/Editor/EditorResources/ToastIcon.png -------------------------------------------------------------------------------- /Assets/BackgroundBuild/Editor/EditorResources/bbuildwindowicon_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RelativeDistance/UnityBackgroundBuild/a54dfa8938b52b16e858d98e3839318509051574/Assets/BackgroundBuild/Editor/EditorResources/bbuildwindowicon_dark.png -------------------------------------------------------------------------------- /Assets/BackgroundBuild/Editor/EditorResources/bbuildwindowicon_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RelativeDistance/UnityBackgroundBuild/a54dfa8938b52b16e858d98e3839318509051574/Assets/BackgroundBuild/Editor/EditorResources/bbuildwindowicon_light.png -------------------------------------------------------------------------------- /Assets/BackgroundBuild/Editor/EditorResources/snoretoast.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RelativeDistance/UnityBackgroundBuild/a54dfa8938b52b16e858d98e3839318509051574/Assets/BackgroundBuild/Editor/EditorResources/snoretoast.exe -------------------------------------------------------------------------------- /Assets/BackgroundBuild/Resources/BackgroundBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 4a2d70f39e20449d8a3841cb6b73de17, type: 3} 13 | m_Name: BackgroundBuildSettings 14 | m_EditorClassIdentifier: 15 | buildTargetSelected: 20 16 | showNotifications: 1 17 | silentBuild: 1 18 | launchBuild: 1 19 | customServer: 0 20 | logBuild: 0 21 | showLog: 0 22 | temporaryFolderPath: 23 | buildFolderPath: 24 | logFolderPath: 25 | webGLURL: http://127.0.0.1/ 26 | browser: 0 27 | -------------------------------------------------------------------------------- /Assets/UnityBackgroundBuild.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RelativeDistance/UnityBackgroundBuild/a54dfa8938b52b16e858d98e3839318509051574/Assets/UnityBackgroundBuild.unitypackage -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020, RelativeDistance 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of the copyright holder nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | 4. Redistribution of this software in source or binary forms shall be free 19 | of all charges or fees to the recipient of this software. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 25 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](Screenshot.png) 2 | 3 | # Unity Background Build 4 | Fire off a background build of your Unity project and continue working on the same project. Most useful for platforms that take a long time to build such as WebGL. 5 | 6 | # How It Works 7 | After applying your settings and pressing build, this plugin duplicates your entire current project, and then runs a silent batch mode build using the current settings and scene list. Optionally it launches the build when complete and logs everything. 8 | 9 | # Installation 10 | Import the [UnityBackgroundBuild.unitypackage](https://github.com/RelativeDistance/UnityBackgroundBuild/raw/master/Assets/UnityBackgroundBuild.unitypackage). Then go Window->Background Build to open the editor window. The following options are presented. 11 | 12 | ## Build Settings 13 | 14 | #### Build Target 15 | Select the platform to build to. If you are building to a different platform than the one you are working on, highly recommended to be using v2 Asset Pipeline so assets won't have to be reimported. Do at least one regular build to your selected target before a background build so your assets are cached. 16 | 17 | #### Temporary Folder 18 | The folder where your project is duplicated to. Highly recommended that you have a fast SSD/NVME drive so this step is as short as possible. This folder will be deleted before a new copy takes place, so be careful where placing it. 19 | 20 | #### Build Folder 21 | Folder where the project is built to. 22 | 23 | #### Show Notifications 24 | Shows OS level notifications for steps during the build. Native on Mac, uses [Snoretoast](https://github.com/KDE/snoretoast) on Windows. 25 | 26 | #### Silent Build 27 | Build without launching the Unity editor. Should be on most of the time. Helpful to turn off to debug issues. Be careful because this will open up a new Unity editor that will look identical to the original, so keep tabs of which project you are working in. 28 | 29 | ## Launch Settings 30 | 31 | #### Launch Build 32 | Just like it says, will launch the build after completing. 33 | 34 | #### Custom Server (WebGL) 35 | Turn on if you are running a custom server, if off, the standard simple server that Unity uses will launch. 36 | 37 | #### Browser (WebGL) 38 | Pick your browser. If your browsers are installed in non-standard places, edit the main script. Safari not available on Windows. Internet explorer not available on Mac. 39 | 40 | #### WebGL URL (WebGL) 41 | URL to launch for custom server option. 42 | 43 | ## Log Settings 44 | 45 | #### Log build 46 | Output build steps to a text file. 47 | 48 | #### Log Folder 49 | Location of log text file. 50 | 51 | #### Show Log 52 | Show the log after build complete. 53 | 54 | ## TODO 55 | - Only copy changed files. 56 | - Show detailed errors in the log. 57 | - Test other platforms besides WebGL, Windows, and Mac. May or may not work with other platforms. 58 | - Needs testing of special characters in paths. 59 | - Allow the use of Unity Package Manager. 60 | 61 | -------------------------------------------------------------------------------- /Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RelativeDistance/UnityBackgroundBuild/a54dfa8938b52b16e858d98e3839318509051574/Screenshot.png --------------------------------------------------------------------------------