Skip to content

Commit ca9aafa

Browse files
author
Unity Technologies
committed
Unity 2022.1.3f1 C# reference source code
1 parent ac1f7b4 commit ca9aafa

4 files changed

Lines changed: 36 additions & 4 deletions

File tree

Editor/Mono/EditorGUI.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,28 @@ public void Dispose()
315315
}
316316
}
317317

318+
internal class DisabledGuiViewInputScope : GUI.Scope
319+
{
320+
GUIView m_View;
321+
bool m_WasDisabled;
322+
323+
public DisabledGuiViewInputScope(GUIView view, bool disabled)
324+
{
325+
m_View = view;
326+
if (m_View != null)
327+
{
328+
m_WasDisabled = view.disableInputEvents;
329+
m_View.disableInputEvents = disabled;
330+
}
331+
}
332+
333+
protected override void CloseScope()
334+
{
335+
if (m_View != null)
336+
m_View.disableInputEvents = m_WasDisabled;
337+
}
338+
}
339+
318340
internal struct LabelHighlightScope : IDisposable
319341
{
320342
bool m_Disposed;

Editor/Mono/EditorUtility.bindings.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using UnityEngine.Scripting;
1111
using System.Collections.Generic;
1212
using System.Linq;
13+
using static UnityEditor.EditorGUI;
1314

1415
namespace UnityEditor
1516
{
@@ -32,7 +33,15 @@ public static string OpenFilePanelWithFilters(string title, string directory, st
3233
public static extern void RevealInFinder(string path);
3334

3435
[FreeFunction("DisplayDialog")]
35-
public static extern bool DisplayDialog(string title, string message, string ok, [DefaultValue("\"\"")] string cancel);
36+
static extern bool DoDisplayDialog(string title, string message, string ok, [DefaultValue("\"\"")] string cancel);
37+
38+
public static bool DisplayDialog(string title, string message, string ok, [DefaultValue("\"\"")] string cancel)
39+
{
40+
using (new DisabledGuiViewInputScope(GUIView.current, true))
41+
{
42+
return DoDisplayDialog(title, message, ok, cancel); ;
43+
}
44+
}
3645

3746
[ExcludeFromDocs]
3847
public static bool DisplayDialog(string title, string message, string ok)

Editor/Mono/ProjectBrowser.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,8 +2079,9 @@ void HandleContextClickInListArea(Rect listRect)
20792079
{
20802080
GUIUtility.hotControl = 0;
20812081

2082-
// Only show menu if there are instances selected
2083-
if (Selection.instanceIDs.Length > 0)
2082+
// In safe mode non-scripts assets aren't selectable and therefore if you context click a non-script
2083+
// asset, then a context menu shouldn't be displayed.
2084+
if (!EditorUtility.isInSafeMode || Selection.instanceIDs.Length > 0)
20842085
{
20852086
// Context click in list area
20862087
EditorUtility.DisplayPopupMenu(new Rect(evt.mousePosition.x, evt.mousePosition.y, 0, 0), "Assets/", null);

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Unity 2022.1.2f1 C# reference source code
1+
## Unity 2022.1.3f1 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)