Skip to content

Commit 25d51bd

Browse files
author
Unity Technologies
committed
Unity 2020.2.0a18 C# reference source code
1 parent 11ba547 commit 25d51bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+469
-297
lines changed

Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -554,11 +554,11 @@ private void RunIl2CppWithArguments(List<string> arguments, Action<ProcessStartI
554554
il2cppOutputParser = new Il2CppOutputParser();
555555

556556
if (ShouldUseIl2CppCore())
557-
il2cppSettings.ToolPath = GetIl2CppCoreExe();
557+
il2cppSettings.ToolPath = $"{EscapeSpacesInPath(GetIl2CppCoreExe())}";
558558
else if (Application.platform == RuntimePlatform.WindowsEditor)
559-
il2cppSettings.ToolPath = GetIl2CppExe();
559+
il2cppSettings.ToolPath = $"{EscapeSpacesInPath(GetIl2CppExe())}";
560560
else
561-
il2cppSettings.ToolPath = $"{GetMonoBleedingEdgeExe()} {GetIl2CppExe()}";
561+
il2cppSettings.ToolPath = $"{EscapeSpacesInPath(GetMonoBleedingEdgeExe())} {EscapeSpacesInPath(GetIl2CppExe())}";
562562

563563
il2cppSettings.Arguments.AddRange(arguments);
564564
il2cppSettings.Serialize(m_PlatformProvider.il2cppBuildCacheDirectory);
@@ -568,8 +568,11 @@ void SetupTundraAndStartInfo(ProcessStartInfo startInfo)
568568
{
569569
if (setupStartInfo != null)
570570
setupStartInfo(startInfo);
571+
572+
// For some reason, TUNDRA_EXECUTABLE needs to be unescaped in order to be found on OSX,
573+
// but MONO_EXECUTABLE needs to be escaped in order to be found on OSX
571574
startInfo.EnvironmentVariables.Add("TUNDRA_EXECUTABLE", GetIl2CppTundraExe());
572-
startInfo.EnvironmentVariables.Add("MONO_EXECUTABLE", GetMonoBleedingEdgeExe());
575+
startInfo.EnvironmentVariables.Add("MONO_EXECUTABLE", EscapeSpacesInPath(GetMonoBleedingEdgeExe()));
573576
}
574577

575578
Console.WriteLine("Invoking il2cpp with arguments: " + args);
@@ -591,42 +594,47 @@ void SetupTundraAndStartInfo(ProcessStartInfo startInfo)
591594
}
592595
}
593596

597+
private string EscapeSpacesInPath(string path)
598+
{
599+
if (Application.platform == RuntimePlatform.WindowsEditor)
600+
return CommandLineFormatter.EscapeCharsWindows(path);
601+
return CommandLineFormatter.EscapeCharsQuote(path);
602+
}
603+
594604
private string GetIl2CppExe()
595605
{
596-
return IL2CPPUtils.GetIl2CppFolder() + "/build/deploy/net471/il2cpp.exe";
606+
return $"{IL2CPPUtils.GetIl2CppFolder()}/build/deploy/net471/il2cpp.exe";
597607
}
598608

599609
private string GetIl2CppCoreExe()
600610
{
601-
return IL2CPPUtils.GetIl2CppFolder() + "/build/deploy/netcoreapp3.0/il2cpp" + (Application.platform == RuntimePlatform.WindowsEditor ? ".exe" : "");
611+
return $"{IL2CPPUtils.GetIl2CppFolder()}/build/deploy/netcoreapp3.0/il2cpp{(Application.platform == RuntimePlatform.WindowsEditor ? ".exe" : "")}";
602612
}
603613

604614
private string GetIl2CppBeeExe()
605615
{
606-
return IL2CPPUtils.GetIl2CppFolder() + "/BeeRunner/bee.exe";
616+
return $"{IL2CPPUtils.GetIl2CppFolder()}/BeeRunner/bee.exe";
607617
}
608618

609619
private string GetIl2CppBeeArtifactsDirectory()
610620
{
611-
return IL2CPPUtils.GetIl2CppFolder() + "/BeeRunner/artifacts";
621+
return $"{IL2CPPUtils.GetIl2CppFolder()}/BeeRunner/artifacts";
612622
}
613623

614624
private string GetIl2CppTundraExe()
615625
{
616626
if (Application.platform == RuntimePlatform.OSXEditor)
617-
return IL2CPPUtils.GetIl2CppFolder() + "/BeeRunner/tundra/tundra-mac-x64/tundra2";
627+
return $"{IL2CPPUtils.GetIl2CppFolder()}/BeeRunner/tundra/tundra-mac-x64/tundra2";
618628
if (Application.platform == RuntimePlatform.LinuxEditor)
619-
return IL2CPPUtils.GetIl2CppFolder() + "/BeeRunner/tundra/tundra-linux-x64/tundra2";
629+
return $"{IL2CPPUtils.GetIl2CppFolder()}/BeeRunner/tundra/tundra-linux-x64/tundra2";
620630

621-
return IL2CPPUtils.GetIl2CppFolder() + "/BeeRunner/tundra/tundra-win-x64/tundra2.exe";
631+
return $"{IL2CPPUtils.GetIl2CppFolder()}/BeeRunner/tundra/tundra-win-x64/tundra2.exe";
622632
}
623633

624634
private string GetMonoBleedingEdgeExe()
625635
{
626-
var path = MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge");
627-
path = Path.Combine(path, "bin");
628-
path = Path.Combine(path, "mono");
629-
return path;
636+
var path = Path.Combine(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "bin");
637+
return Path.Combine(path, "mono");
630638
}
631639

632640
private bool ShouldUseIl2CppCore()

Editor/Mono/EditorSceneManager.bindings.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,29 @@ public extern static SceneAsset playModeStartScene
6868
[NativeMethod("OpenScene")]
6969
public extern static Scene OpenScene(string scenePath, [uei.DefaultValue("OpenSceneMode.Single")] OpenSceneMode mode);
7070

71+
internal static Scene OpenPreviewScene(string scenePath)
72+
{
73+
return OpenPreviewScene(scenePath, true);
74+
}
75+
7176
[NativeThrows]
7277
[StaticAccessor("EditorSceneManagerBindings", StaticAccessorType.DoubleColon)]
7378
[NativeMethod("OpenPreviewScene")]
74-
internal extern static Scene OpenPreviewScene(string scenePath);
79+
internal extern static Scene OpenPreviewScene(string scenePath, bool allocateSceneCullingMask);
7580

7681
[NativeThrows]
7782
[StaticAccessor("EditorSceneManagerBindings", StaticAccessorType.DoubleColon)]
7883
[NativeMethod("NewScene")]
7984
public extern static Scene NewScene(NewSceneSetup setup, [uei.DefaultValue("NewSceneMode.Single")] NewSceneMode mode);
8085

86+
public static Scene NewPreviewScene()
87+
{
88+
return NewPreviewScene(true);
89+
}
90+
8191
[StaticAccessor("EditorSceneManagerBindings", StaticAccessorType.DoubleColon)]
8292
[NativeMethod("NewPreviewScene")]
83-
public extern static Scene NewPreviewScene();
93+
internal extern static Scene NewPreviewScene(bool allocateSceneCullingMask);
8494

8595
[StaticAccessor("GetSceneManager()", StaticAccessorType.Dot)]
8696
[NativeMethod("CreateSceneAsset")]

0 commit comments

Comments
 (0)