Skip to content

Commit fc5ec77

Browse files
author
Stephen Hodgson
committed
Updated Build window with scripting backend options and warns users before building project without scenes
1 parent 4ff9658 commit fc5ec77

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

Assets/HoloToolkit/BuildAndDeploy/Editor/BuildDeployTools.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,32 @@ public static bool IsIl2CppAvailable()
4242
return Directory.Exists(EditorApplication.applicationContentsPath + "\\PlaybackEngines\\MetroSupport\\Managed\\il2cpp");
4343
}
4444

45+
/// <summary>
46+
/// Displays a dialog if no scenes are present in the build and returns true if build can proceed.
47+
/// </summary>
48+
/// <returns></returns>
49+
public static bool CheckBuildScenes()
50+
{
51+
if (EditorBuildSettings.scenes.Length == 0)
52+
{
53+
return EditorUtility.DisplayDialog("Attention!",
54+
"No scenes are present in the build settings!\n\n Do you want to cancel and add one?",
55+
"Continue Anyway", "Cancel Build");
56+
}
57+
58+
return true;
59+
}
60+
4561
public static bool BuildSLN(string buildDirectory, bool showDialog = true)
4662
{
4763
// Use BuildSLNUtilities to create the SLN
4864
bool buildSuccess = false;
4965

66+
if (CheckBuildScenes() == false)
67+
{
68+
return false;
69+
}
70+
5071
var buildInfo = new BuildInfo
5172
{
5273
// These properties should all match what the Standalone.proj file specifies

Assets/HoloToolkit/BuildAndDeploy/Editor/BuildDeployWindow.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,18 @@ private void OnGUI()
327327

328328
currentSDKVersionIndex = EditorGUILayout.Popup(GUIHorizontalSpacer + "SDK Version", currentSDKVersionIndex, windowsSdkPaths);
329329

330+
var curScriptingBackend = PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA);
331+
var newScriptingBackend = (ScriptingImplementation)EditorGUILayout.IntPopup(
332+
"Scripting Backend",
333+
(int)curScriptingBackend,
334+
new[] { "IL2CPP", ".NET" },
335+
new[] { (int)ScriptingImplementation.IL2CPP, (int)ScriptingImplementation.WinRTDotNET });
336+
337+
if (newScriptingBackend != curScriptingBackend)
338+
{
339+
PlayerSettings.SetScriptingBackend(BuildTargetGroup.WSA, newScriptingBackend);
340+
}
341+
330342
string newSDKVersion = windowsSdkPaths[currentSDKVersionIndex];
331343

332344
if (!newSDKVersion.Equals(currentSDKVersion))
@@ -335,7 +347,6 @@ private void OnGUI()
335347
}
336348

337349
string newMSBuildVer = currentSDKVersionIndex <= defaultMSBuildVersionIndex ? BuildDeployTools.DefaultMSBuildVersion : "15.0";
338-
EditorGUILayout.LabelField(GUIHorizontalSpacer + "MS Build Version", newMSBuildVer);
339350

340351
if (!newMSBuildVer.Equals(curMSBuildVer))
341352
{

0 commit comments

Comments
 (0)