Skip to content

Commit fd172e0

Browse files
author
Unity Technologies
committed
Unity 2019.2.18f1 C# reference source code
1 parent 65c9024 commit fd172e0

12 files changed

Lines changed: 63 additions & 31 deletions

File tree

Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,13 @@ private void ProcessIl2CppOutputForBinary(BuildPostProcessArgs args)
289289
var dataBackupFolder = Path.Combine(args.stagingArea, GetIl2CppDataBackupFolderName(args));
290290
FileUtil.CreateOrCleanDirectory(dataBackupFolder);
291291

292+
var il2cppOutputFolder = Path.Combine(args.stagingAreaData, "il2cppOutput");
293+
294+
// Delete duplicate il2cpp_data that was created in il2cppOutput directory (case 1198179)
295+
FileUtil.DeleteFileOrDirectory(Path.Combine(il2cppOutputFolder, "Data"));
296+
292297
// Move generated C++ code out of Data directory
293-
FileUtil.MoveFileOrDirectory(Path.Combine(args.stagingAreaData, "il2cppOutput"), Path.Combine(dataBackupFolder, "il2cppOutput"));
298+
FileUtil.MoveFileOrDirectory(il2cppOutputFolder, Path.Combine(dataBackupFolder, "il2cppOutput"));
294299

295300
if (IL2CPPUtils.UseIl2CppCodegenWithMonoBackend(BuildPipeline.GetBuildTargetGroup(args.target)))
296301
{

Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,10 @@ public void RunCompileAndLink()
365365
var compilerConfiguration = PlayerSettings.GetIl2CppCompilerConfiguration(buildTargetGroup);
366366
var arguments = Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, OutputFileRelativePath(), m_PlatformProvider.includePaths, m_PlatformProvider.libraryPaths, compilerConfiguration).ToList();
367367

368+
var additionalArgs = IL2CPPUtils.GetAdditionalArguments();
369+
if (!string.IsNullOrEmpty(additionalArgs))
370+
arguments.Add(additionalArgs);
371+
368372
arguments.Add($"--map-file-parser={CommandLineFormatter.PrepareFileName(GetMapFileParserPath())}");
369373
arguments.Add($"--generatedcppdir={CommandLineFormatter.PrepareFileName(Path.GetFullPath(GetCppOutputDirectoryInStagingArea()))}");
370374
arguments.Add(string.Format("--dotnetprofile=\"{0}\"", IL2CPPUtils.ApiCompatibilityLevelToDotNetProfileArgument(PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup))));

Editor/Mono/Inspector/UnityEventDrawer.cs

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -389,22 +389,37 @@ static UnityEventBase GetDummyEvent(SerializedProperty prop)
389389
if (tgtobj == null)
390390
return new UnityEvent();
391391

392-
string propPath = prop.propertyPath;
392+
UnityEventBase ret = null;
393393
Type ft = tgtobj.GetType();
394+
var bindflags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
395+
do
396+
{
397+
ret = GetDummyEventHelper(prop.propertyPath, ft, bindflags);
398+
//no need to look for public members again since the base type covered that
399+
bindflags = BindingFlags.Instance | BindingFlags.NonPublic;
400+
ft = ft.BaseType;
401+
}
402+
while (ret == null && ft != null);
403+
// go up the class hierarchy if it exists and the property is not found on the child
404+
return (ret == null) ? new UnityEvent() : ret;
405+
}
406+
407+
private static UnityEventBase GetDummyEventHelper(string propPath, Type targetObjectType, BindingFlags flags)
408+
{
394409
while (propPath.Length != 0)
395410
{
396411
//we could have a leftover '.' if the previous iteration handled an array element
397412
if (propPath.StartsWith("."))
398413
propPath = propPath.Substring(1);
399414

400415
var splits = propPath.Split(new[] { '.' }, 2);
401-
var newField = ft.GetField(splits[0], BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
416+
var newField = targetObjectType.GetField(splits[0], flags);
402417
if (newField == null)
403418
break;
404419

405-
ft = newField.FieldType;
406-
if (ft.IsArrayOrList())
407-
ft = ft.GetArrayOrListElementType();
420+
targetObjectType = newField.FieldType;
421+
if (targetObjectType.IsArrayOrList())
422+
targetObjectType = targetObjectType.GetArrayOrListElementType();
408423

409424
//the last item in the property path could have been an array element
410425
//bail early in that case
@@ -415,9 +430,9 @@ static UnityEventBase GetDummyEvent(SerializedProperty prop)
415430
if (propPath.StartsWith("Array.data["))
416431
propPath = propPath.Split(new[] { ']' }, 2)[1];
417432
}
418-
if (ft.IsSubclassOf(typeof(UnityEventBase)))
419-
return Activator.CreateInstance(ft) as UnityEventBase;
420-
return new UnityEvent();
433+
if (targetObjectType.IsSubclassOf(typeof(UnityEventBase)))
434+
return Activator.CreateInstance(targetObjectType) as UnityEventBase;
435+
return null;
421436
}
422437

423438
struct ValidMethodMap

Editor/Mono/Networking/PlayerConnection/AttachToPlayerGUI.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,10 @@ void AddAvailablePlayerConnections(GenericMenu menuOptions, ref bool hasOpenConn
200200
menuOptions.AddItem(new GUIContent(name), isConnected, () =>
201201
{
202202
ProfilerDriver.connectedProfiler = guid;
203-
SuccesfullyConnectedToPlayer(connectionName);
203+
if (ProfilerDriver.connectedProfiler == guid)
204+
{
205+
SuccesfullyConnectedToPlayer(connectionName);
206+
}
204207
});
205208
else
206209
menuOptions.AddDisabledItem(new GUIContent(name), isConnected);

Editor/Mono/SceneManagement/StageManager/Stage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public T FindComponentOfType<T>() where T : Component
4040
for (int i = 0; i < components.Length; i++)
4141
{
4242
T obj = components[i];
43-
if (!EditorSceneManager.IsPreviewScene(obj.gameObject.scene))
43+
if (!EditorUtility.IsPersistent(obj) && !EditorSceneManager.IsPreviewScene(obj.gameObject.scene))
4444
return obj;
4545
}
4646
}
@@ -68,7 +68,7 @@ public T[] FindComponentsOfType<T>() where T : Component
6868
for (int i = 0; i < components.Length; i++)
6969
{
7070
T obj = components[i];
71-
if (!EditorSceneManager.IsPreviewScene(obj.gameObject.scene))
71+
if (!EditorUtility.IsPersistent(obj) && !EditorSceneManager.IsPreviewScene(obj.gameObject.scene))
7272
componentList.Add(obj);
7373
}
7474
}

Editor/Mono/ScriptEditorUtility.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,9 @@ internal static bool IsVisualStudioForMac(string path)
6565
return filename.StartsWith("visualstudio") && !filename.Contains("code") && filename.EndsWith(".app");
6666
}
6767

68-
#pragma warning disable 618
6968
public static string GetExternalScriptEditor()
7069
{
71-
var editor = CodeEditor.CurrentEditorInstallation;
72-
73-
if (!string.IsNullOrEmpty(editor))
74-
return editor;
75-
76-
// If no script editor is set, try to use first found supported one.
77-
var editorPaths = GetFoundScriptEditorPaths(Application.platform);
78-
79-
if (editorPaths.Count > 0)
80-
return editorPaths.Keys.ToArray()[0];
81-
82-
return string.Empty;
70+
return CodeEditor.CurrentEditorInstallation;
8371
}
8472

8573
[Obsolete("This method has been moved to CodeEditor.SetExternalScriptEditor", false)]

Modules/ProfilerEditor/ProfilerWindow/UISystem/UISystemProfiler.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@ internal class UISystemProfiler
2727

2828
private int currentFrame = 0;
2929

30+
private Material previewTextureMaterial;
31+
32+
public UISystemProfiler()
33+
{
34+
setupPreviewTextureMaterial();
35+
}
36+
37+
internal void setupPreviewTextureMaterial()
38+
{
39+
if (previewTextureMaterial != null)
40+
return;
41+
42+
previewTextureMaterial = new Material(EditorGUI.transparentMaterial);
43+
previewTextureMaterial.SetColor("_ColorMask", new Color(1, 1, 1, 1));
44+
}
45+
3046
internal void DrawUIPane(ProfilerWindow win, ProfilerArea profilerArea, UISystemProfilerChart detailsChart)
3147
{
3248
InitIfNeeded(win);
@@ -189,8 +205,9 @@ internal void DrawRenderUI()
189205
EditorGUI.DrawRect(m_ZoomablePreview.drawRect,
190206
previewBackground == Styles.PreviewBackgroundType.Black ? Color.black : Color.white);
191207
}
208+
192209
Graphics.DrawTexture(m_ZoomablePreview.drawRect, image, m_ZoomablePreview.shownArea, 0, 0, 0, 0,
193-
previewRenderMode == Styles.RenderMode.CompositeOverdraw ? m_CompositeOverdrawMaterial : EditorGUI.transparentMaterial);
210+
previewRenderMode == Styles.RenderMode.CompositeOverdraw ? m_CompositeOverdrawMaterial : previewTextureMaterial);
194211
}
195212
if (previewRenderMode != Styles.RenderMode.Standard)
196213
break;

Projects/CSharp/UnityEditor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7-
7+
<ProjectGuid>{016C8D73-3641-47FB-8D33-7A015A7EC7DB}</ProjectGuid>
88
<OutputType>Library</OutputType>
99
<RootNamespace>UnityEditor</RootNamespace>
1010
<AssemblyName>UnityEditor</AssemblyName>

Projects/CSharp/UnityEngine.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7-
7+
<ProjectGuid>{F0499708-3EB6-4026-8362-97E6FFC4E7C8}</ProjectGuid>
88
<OutputType>Library</OutputType>
99
<RootNamespace>UnityEngine</RootNamespace>
1010
<AssemblyName>UnityEngine</AssemblyName>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Unity 2019.2.17f1 C# reference source code
1+
## Unity 2019.2.18f1 C# reference source code
22

33
The C# part of the Unity engine and editor source code.
44
May be used for reference purposes only.

0 commit comments

Comments
 (0)