Skip to content

Commit e83cf78

Browse files
author
Unity Technologies
committed
Unity 2021.1.0a9 C# reference source code
1 parent 5e1aa94 commit e83cf78

File tree

116 files changed

+856
-584
lines changed

Some content is hidden

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

116 files changed

+856
-584
lines changed

Editor/Mono/2D/SpriteAtlas/SpriteAtlasImporterInspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ void OnEnable()
236236

237237
m_EnableTightPacking = serializedAssetObject.FindProperty("m_ImporterData.packingSettings.enableTightPacking");
238238
m_EnableRotation = serializedAssetObject.FindProperty("m_ImporterData.packingSettings.enableRotation");
239-
m_EnableAlphaDilation = serializedObject.FindProperty("m_EditorData.packingSettings.enableAlphaDilation");
239+
m_EnableAlphaDilation = serializedAssetObject.FindProperty("m_ImporterData.packingSettings.enableAlphaDilation");
240240
m_Padding = serializedAssetObject.FindProperty("m_ImporterData.packingSettings.padding");
241241

242242
m_MasterAtlas = serializedAssetObject.FindProperty("m_MasterAtlas");

Editor/Mono/AssemblyInfo/AssemblyInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
[assembly: InternalsVisibleTo("UnityEditor.Android.Extensions")]
4040
[assembly: InternalsVisibleTo("UnityEditor.XboxOne.Extensions")]
4141
[assembly: InternalsVisibleTo("UnityEditor.PS4.Extensions")]
42+
[assembly: InternalsVisibleTo("UnityEditor.PS5.Extensions")]
4243
[assembly: InternalsVisibleTo("UnityEditor.Switch.Extensions")]
4344
[assembly: InternalsVisibleTo("UnityEditor.WebGL.Extensions")]
4445
[assembly: InternalsVisibleTo("UnityEditor.LinuxStandalone.Extensions")]
@@ -121,6 +122,7 @@
121122
[assembly: InternalsVisibleTo("Unity.UIElements.Tests")]
122123
[assembly: InternalsVisibleTo("Unity.UIElements.EditorTests")]
123124
[assembly: InternalsVisibleTo("UnityEditor.UIElementsGameObjectsModule")]
125+
[assembly: InternalsVisibleTo("UnityEditor.TextCoreTextModule")]
124126

125127
[assembly: InternalsVisibleTo("Unity.SceneTemplate.Editor")]
126128
[assembly: InternalsVisibleTo("com.unity.purchasing.udp.Editor")]

Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ public override void UpdateBootConfig(BuildTarget target, BootConfigData config,
9494
if (IL2CPPUtils.UseIl2CppCodegenWithMonoBackend(BuildPipeline.GetBuildTargetGroup(target)))
9595
config.Set("mono-codegen", "il2cpp");
9696
if ((options & BuildOptions.EnableHeadlessMode) != 0)
97+
{
9798
config.AddKey("headless");
99+
config.AddKey("force-gfx-direct");
100+
}
98101
if ((options & BuildOptions.EnableCodeCoverage) != 0)
99102
config.Set("enableCodeCoverage", "1");
100103
if (!PlayerSettings.usePlayerLog)

Editor/Mono/BuildTarget.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ public enum BuildTarget
127127
GameCoreScarlett = 42,
128128
GameCoreXboxOne = 43,
129129

130+
PS5 = 44,
131+
132+
130133
// obsolete identifiers. We're using different values so that ToString() works.
131134
[System.Obsolete("Use iOS instead (UnityUpgradable) -> iOS", true)]
132135
iPhone = -1,

Editor/Mono/BuildTargetConverter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ internal class BuildTargetConverter
1616
return RuntimePlatform.Android;
1717
case BuildTarget.PS4:
1818
return RuntimePlatform.PS4;
19+
case BuildTarget.PS5:
20+
return RuntimePlatform.PS5;
1921
case BuildTarget.StandaloneLinux64:
2022
return RuntimePlatform.LinuxPlayer;
2123
case BuildTarget.StandaloneOSX:

Editor/Mono/BuildTargetGroup.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ public enum BuildTargetGroup
102102
CloudRendering = 30,
103103

104104
GameCoreScarlett = 31,
105-
GameCoreXboxOne = 32
105+
GameCoreXboxOne = 32,
106+
107+
PS5 = 33,
106108
}
107109
}

Editor/Mono/EditorGUI.cs

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,22 @@ public void Dispose()
317317
}
318318
}
319319

320+
internal struct CursorColorScope : IDisposable
321+
{
322+
private Color oldCursorColor;
323+
324+
public CursorColorScope(Color color)
325+
{
326+
oldCursorColor = GUI.skin.settings.cursorColor;
327+
GUI.skin.settings.cursorColor = color;
328+
}
329+
330+
public void Dispose()
331+
{
332+
GUI.skin.settings.cursorColor = oldCursorColor;
333+
}
334+
}
335+
320336
// Create a group of controls that can be disabled.
321337
internal static void BeginDisabled(bool disabled)
322338
{
@@ -584,14 +600,14 @@ static void ShowTextEditorPopupMenu()
584600
// Cut
585601
if (RecycledTextEditor.s_AllowContextCutOrPaste)
586602
{
587-
if (s_RecycledEditor.hasSelection && !s_RecycledEditor.isPasswordField && enabled)
603+
if (s_RecycledEditor.hasSelection && !s_RecycledEditor.isPasswordField && enabled && !EditorGUI.showMixedValue)
588604
pm.AddItem(EditorGUIUtility.TrTextContent("Cut"), false, new PopupMenuEvent(EventCommandNames.Cut, GUIView.current).SendEvent);
589605
else
590606
pm.AddDisabledItem(EditorGUIUtility.TrTextContent("Cut"));
591607
}
592608

593609
// Copy -- when GUI is disabled, allow Copy even with no selection (will copy everything)
594-
if ((s_RecycledEditor.hasSelection || !enabled) && !s_RecycledEditor.isPasswordField)
610+
if ((s_RecycledEditor.hasSelection || !enabled) && !s_RecycledEditor.isPasswordField && !EditorGUI.showMixedValue)
595611
pm.AddItem(EditorGUIUtility.TrTextContent("Copy"), false, new PopupMenuEvent(EventCommandNames.Copy, GUIView.current).SendEvent);
596612
else
597613
pm.AddDisabledItem(EditorGUIUtility.TrTextContent("Copy"));
@@ -1912,19 +1928,17 @@ internal static void SelectableLabelInternal(Rect position, string text, GUIStyl
19121928
sendEventToTextEditor = false;
19131929
}
19141930

1915-
1916-
Color tempCursorColor = GUI.skin.settings.cursorColor;
1917-
GUI.skin.settings.cursorColor = new Color(0, 0, 0, 0);
1918-
1919-
RecycledTextEditor.s_AllowContextCutOrPaste = false;
1920-
1921-
if (sendEventToTextEditor)
1931+
// Its possible that DoTextField will throw so we use a scoped cursor that we can safely reset the color.
1932+
using (new CursorColorScope(Color.clear))
19221933
{
1923-
bool dummy;
1924-
DoTextField(s_RecycledEditor, id, IndentedRect(position), text, style, string.Empty, out dummy, false, true, false);
1925-
}
1934+
RecycledTextEditor.s_AllowContextCutOrPaste = false;
19261935

1927-
GUI.skin.settings.cursorColor = tempCursorColor;
1936+
if (sendEventToTextEditor)
1937+
{
1938+
bool dummy;
1939+
DoTextField(s_RecycledEditor, id, IndentedRect(position), text, style, string.Empty, out dummy, false, true, false);
1940+
}
1941+
}
19281942
}
19291943

19301944
[Obsolete("Use PasswordField instead.")]

Editor/Mono/EditorGUIUtility.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,7 @@ internal static void ResetGUIState()
12001200
EditorGUI.ClearStacks();
12011201
fieldWidth = 0;
12021202
labelWidth = 0;
1203+
currentViewWidth = -1f;
12031204

12041205
SetBoldDefaultFont(false);
12051206
UnlockContextWidth();
@@ -1314,7 +1315,21 @@ internal static float contextWidth
13141315
}
13151316
}
13161317

1317-
public static float currentViewWidth => GUIView.current ? GUIView.current.position.width : 0;
1318+
private static float s_OverriddenViewWidth = -1f;
1319+
public static float currentViewWidth
1320+
{
1321+
get
1322+
{
1323+
if (s_OverriddenViewWidth > 0f)
1324+
return s_OverriddenViewWidth;
1325+
CheckOnGUI();
1326+
return GUIView.current ? GUIView.current.position.width : 0;
1327+
}
1328+
internal set
1329+
{
1330+
s_OverriddenViewWidth = value;
1331+
}
1332+
}
13181333

13191334
public static float labelWidth
13201335
{

Editor/Mono/EditorUserBuildSettings.bindings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ public enum WSABuildAndRunDeployTarget
177177
/// *undocumented*
178178
LocalMachine = 0,
179179
/// *undocumented*
180+
[System.Obsolete("UnityEditor.WSABuildAndRunDeployTarget.WindowsPhone is obsolete.", true)]
180181
WindowsPhone = 1,
181182
/// *undocumented*
182183
DevicePortal = 2

Editor/Mono/GUI/AppStatusBar.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ protected override void OnDisable()
9898
Progress.added -= RefreshProgressBar;
9999
Progress.removed -= RefreshProgressBar;
100100
Progress.updated -= RefreshProgressBar;
101+
EditorApplication.delayCall -= DelayRepaint;
101102
base.OnDisable();
102103
}
103104

@@ -239,9 +240,15 @@ private void DrawSpecialModeLabel()
239240

240241
float k_SpaceBeforeProgress = 15;
241242
float k_SpaceAfterProgress = 4;
243+
244+
private void DelayRepaint()
245+
{
246+
Repaint();
247+
}
248+
242249
private void DrawProgressBar()
243250
{
244-
if (!showProgress)
251+
if (!this || !showProgress)
245252
return;
246253

247254
GUILayout.Space(k_SpaceBeforeProgress);
@@ -259,7 +266,7 @@ private void DrawProgressBar()
259266
Progress.ShowDetails();
260267

261268
if (globalProgress == -1.0f)
262-
EditorApplication.delayCall += () => Repaint();
269+
EditorApplication.delayCall += DelayRepaint;
263270

264271
EditorGUIUtility.AddCursorRect(progressRect, MouseCursor.Link);
265272
GUILayout.Space(k_SpaceAfterProgress);
@@ -350,6 +357,9 @@ private void DrawStatusText()
350357

351358
private void RefreshProgressBar(Progress.Item[] progressItems)
352359
{
360+
if (!this || !showProgress)
361+
return;
362+
353363
var idleCount = Progress.EnumerateItems().Count(item => item.running && item.priority == (int)Progress.Priority.Idle);
354364
var taskCount = Progress.GetRunningProgressCount() - idleCount;
355365
if (taskCount == 0)

0 commit comments

Comments
 (0)