Skip to content

Commit cbabc42

Browse files
author
Unity Technologies
committed
Unity 2022.1.0b16 C# reference source code
1 parent 0690d07 commit cbabc42

File tree

16 files changed

+425
-67
lines changed

16 files changed

+425
-67
lines changed

Editor/Mono/Scripting/APIUpdater/APIUpdaterAssemblyHelper.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,7 @@ internal static int Run(string arguments, string workingDir, out string stdOut,
4848
return assemblyUpdaterProcess.ExitCode;
4949
}
5050

51-
static string AssemblyUpdaterPath()
52-
{
53-
var unescapedAssemblyUpdaterPath = EditorApplication.applicationContentsPath + "/Tools/ScriptUpdater/AssemblyUpdater.exe";
54-
return Application.platform == RuntimePlatform.WindowsEditor
55-
? CommandLineFormatter.EscapeCharsWindows(unescapedAssemblyUpdaterPath)
56-
: CommandLineFormatter.EscapeCharsQuote(unescapedAssemblyUpdaterPath);
57-
}
51+
static string AssemblyUpdaterPath() => EditorApplication.applicationContentsPath + "/Tools/ScriptUpdater/AssemblyUpdater.exe";
5852

5953
internal static string ArgumentsForUpdateAssembly(string assemblyPath, string tempOutputPath, IEnumerable<string> updateConfigSourcePaths)
6054
{

External/MirroredPackageSources/com.unity.ui.builder/Editor/Builder/Library/BuilderLibraryContent.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ public static void RegenerateLibraryContent()
9292
{
9393
standardControlsTree = GenerateControlsItemsTree();
9494
standardControlsTreeNoEditor = new List<TreeViewItem>();
95-
var controlsItemsTree = GenerateControlsItemsTree();
96-
foreach (var item in controlsItemsTree)
95+
foreach (var item in standardControlsTree)
9796
{
9897
var builderLibraryTreeItem = item.data;
9998
if (builderLibraryTreeItem.isEditorOnly)

ModuleOverrides/com.unity.ui/Core/Clickable.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ protected override void RegisterCallbacksOnTarget()
120120
{
121121
target.RegisterCallback<MouseDownEvent>(OnMouseDown, invokePolicy);
122122
target.RegisterCallback<MouseMoveEvent>(OnMouseMove, invokePolicy);
123-
target.RegisterCallback<MouseUpEvent>(OnMouseUp, invokePolicy);
124-
target.RegisterCallback<MouseCaptureOutEvent>(OnMouseCaptureOut, invokePolicy);
123+
target.RegisterCallback<MouseUpEvent>(OnMouseUp, InvokePolicy.IncludeDisabled);
124+
target.RegisterCallback<MouseCaptureOutEvent>(OnMouseCaptureOut, InvokePolicy.IncludeDisabled);
125125

126126
target.RegisterCallback<PointerDownEvent>(OnPointerDown, invokePolicy);
127127
target.RegisterCallback<PointerMoveEvent>(OnPointerMove, invokePolicy);
128-
target.RegisterCallback<PointerUpEvent>(OnPointerUp, invokePolicy);
129-
target.RegisterCallback<PointerCancelEvent>(OnPointerCancel, invokePolicy);
130-
target.RegisterCallback<PointerCaptureOutEvent>(OnPointerCaptureOut, invokePolicy);
128+
target.RegisterCallback<PointerUpEvent>(OnPointerUp, InvokePolicy.IncludeDisabled);
129+
target.RegisterCallback<PointerCancelEvent>(OnPointerCancel, InvokePolicy.IncludeDisabled);
130+
target.RegisterCallback<PointerCaptureOutEvent>(OnPointerCaptureOut, InvokePolicy.IncludeDisabled);
131131
}
132132

133133
/// <summary>

ModuleOverrides/com.unity.ui/Core/Controls/BaseTreeView.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,8 @@ public bool TryRemoveItem(int id)
328328
internal override void OnViewDataReady()
329329
{
330330
base.OnViewDataReady();
331-
if (viewController != null)
332-
{
333-
viewController.RebuildTree();
334-
RefreshItems();
335-
}
331+
viewController?.RebuildTree();
332+
RefreshItems();
336333
}
337334

338335
private void OnScrollViewKeyDown(KeyDownEvent evt)

ModuleOverrides/com.unity.ui/Core/Controls/BaseVerticalCollectionView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ protected override void ExecuteDefaultAction(EventBase evt)
14551455
// and set it back in Setup().
14561456
else if (evt.eventTypeId == FocusEvent.TypeId())
14571457
{
1458-
m_VirtualizationController.OnFocus(evt.leafTarget as VisualElement);
1458+
m_VirtualizationController?.OnFocus(evt.leafTarget as VisualElement);
14591459
}
14601460
else if (evt.eventTypeId == NavigationSubmitEvent.TypeId())
14611461
{

ModuleOverrides/com.unity.ui/Core/GameObjects/PanelSettings.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ private void DisposeRelatedPanel()
152152
{
153153
UIElementsRuntimeUtility.DisposeRuntimePanel(m_Settings);
154154
}
155+
156+
internal void MarkPotentiallyEmpty()
157+
{
158+
UIElementsRuntimeUtility.MarkPotentiallyEmpty(m_Settings);
159+
}
155160
}
156161

157162

@@ -475,6 +480,7 @@ internal static void SetupLiveReloadPanelTrackers(bool isLiveReloadOn)
475480
private Rect m_TargetRect;
476481
private float m_ResolvedScale; // panel scaling factor (pixels <-> points)
477482

483+
internal int m_EmptyPanelCounter = 0;
478484
private PanelSettings()
479485
{
480486
m_PanelAccess = new RuntimePanelAccess(this);
@@ -517,6 +523,11 @@ private void OnDisable()
517523
m_PanelAccess.DisposePanel();
518524
}
519525

526+
internal void DisposePanel()
527+
{
528+
m_PanelAccess.DisposePanel();
529+
}
530+
520531
private void ApplyThemeStyleSheet(VisualElement root = null)
521532
{
522533
if (!m_PanelAccess.isInitialized)
@@ -705,10 +716,7 @@ internal void DetachUIDocument(UIDocument uiDocument)
705716
m_AttachedUIDocumentsList.RemoveFromListAndFromVisualTree(uiDocument);
706717

707718
if (m_AttachedUIDocumentsList.m_AttachedUIDocuments.Count == 0)
708-
{
709-
// No references to the panel, we can dispose it and it'll be recreated if it's used again.
710-
m_PanelAccess.DisposePanel();
711-
}
719+
m_PanelAccess.MarkPotentiallyEmpty();
712720
}
713721

714722
private float m_OldReferenceDpi;

0 commit comments

Comments
 (0)