Skip to content

Commit bf78020

Browse files
author
Unity Technologies
committed
Unity 6000.0.2f1 C# reference source code
1 parent b1c78d1 commit bf78020

File tree

51 files changed

+946
-555
lines changed

Some content is hidden

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

51 files changed

+946
-555
lines changed

Editor/Mono/Audio/AudioContainerWindow.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1343,6 +1343,19 @@ void OnAssetsDeleted(IEnumerable<string> paths)
13431343
}
13441344
}
13451345

1346+
void OnAssetsMoved(IEnumerable<string> paths)
1347+
{
1348+
// If there is no target we are in day 0 state.
1349+
if (State.AudioContainer == null)
1350+
return;
1351+
1352+
foreach (var path in paths)
1353+
if (path == State.TargetPath)
1354+
{
1355+
State.UpdateTargetPath();
1356+
}
1357+
}
1358+
13461359
class AudioContainerModificationProcessor : AssetModificationProcessor
13471360
{
13481361
/// <summary>
@@ -1366,11 +1379,14 @@ class AudioContainerPostProcessor : AssetPostprocessor
13661379
/// and relays it to AudioContainerWindow,
13671380
/// refreshing or clearing the window content.
13681381
/// </summary>
1369-
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
1382+
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssets)
13701383
{
13711384
if (Instance == null)
13721385
return;
13731386

1387+
if (movedFromAssets.Length > 0)
1388+
Instance.OnAssetsMoved(movedFromAssets);
1389+
13741390
if (importedAssets.Length > 0)
13751391
Instance.OnAssetsImported(importedAssets);
13761392

Editor/Mono/Audio/AudioContainerWindowState.cs

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System;
66
using UnityEditor.UIElements;
77
using UnityEngine;
8+
using UnityEngine.Assertions;
89
using UnityEngine.Audio;
910
using UnityEngine.UIElements;
1011
using Object = UnityEngine.Object;
@@ -59,13 +60,25 @@ internal SerializedObject SerializedObject
5960

6061
internal string TargetPath { get; private set; }
6162

63+
internal void UpdateTargetPath()
64+
{
65+
if (m_AudioContainer != null)
66+
{
67+
TargetPath = AssetDatabase.GetAssetPath(m_AudioContainer);
68+
}
69+
else
70+
{
71+
TargetPath = null;
72+
}
73+
}
74+
6275
internal void Reset()
6376
{
6477
Stop();
6578
m_AudioContainer = null;
6679
m_SerializedObject = null;
6780
m_IsPlayingOrPausedLocalFlag = false;
68-
TargetPath = null;
81+
UpdateTargetPath();
6982
}
7083

7184
internal VisualElement GetResourceTrackerElement()
@@ -164,7 +177,7 @@ void UpdateTarget()
164177

165178
if (m_AudioContainer != null)
166179
{
167-
TargetPath = AssetDatabase.GetAssetPath(m_AudioContainer);
180+
UpdateTargetPath();
168181
}
169182

170183
if (targetChanged)
@@ -174,17 +187,7 @@ void UpdateTarget()
174187

175188
if (trackedSourceChanged)
176189
{
177-
if (m_ResourceTrackerElement != null)
178-
{
179-
m_ResourceTrackerElement.Unbind();
180-
}
181-
182-
if (m_TrackedSource != null)
183-
{
184-
var trackedSourceSO = new SerializedObject(m_TrackedSource);
185-
var trackedSourceResourceProperty = trackedSourceSO.FindProperty("m_Resource");
186-
m_ResourceTrackerElement.TrackPropertyValue(trackedSourceResourceProperty, OnResourceChanged);
187-
}
190+
UpdateResourceTrackerElement();
188191
}
189192
}
190193

@@ -199,9 +202,28 @@ void OnResourceChanged(SerializedProperty property)
199202
m_AudioContainer = container;
200203

201204
if (m_AudioContainer != null)
202-
TargetPath = AssetDatabase.GetAssetPath(m_AudioContainer);
205+
{
206+
UpdateTargetPath();
207+
}
203208

204209
TargetChanged?.Invoke(this, EventArgs.Empty);
210+
211+
UpdateResourceTrackerElement();
212+
}
213+
214+
private void UpdateResourceTrackerElement()
215+
{
216+
if (m_ResourceTrackerElement != null)
217+
{
218+
m_ResourceTrackerElement.Unbind();
219+
}
220+
221+
if (m_TrackedSource != null)
222+
{
223+
var trackedSourceSO = new SerializedObject(m_TrackedSource);
224+
var trackedSourceResourceProperty = trackedSourceSO.FindProperty("m_Resource");
225+
m_ResourceTrackerElement.TrackPropertyValue(trackedSourceResourceProperty, OnResourceChanged);
226+
}
205227
}
206228

207229
internal void Play()

Editor/Mono/BuildProfile/BuildProfileModuleUtil.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ internal class BuildProfileModuleUtil
3131
static HashSet<string> s_BuildProfileIconModules = new()
3232
{
3333
"Switch",
34-
"QNX",
3534
};
3635

3736
/// <summary>

Editor/Mono/ContainerWindow.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ public ContainerWindow()
6868
m_UnsavedEditorWindows = new List<EditorWindow>();
6969
}
7070

71+
private static Func<bool> MppmCloseCallback;
72+
7173
internal void __internalAwake()
7274
{
7375
hideFlags = HideFlags.DontSave;
@@ -325,12 +327,14 @@ internal bool CanCloseAllExcept(EditorWindow editorWindow)
325327

326328
private static bool MultiplayerCloneClose()
327329
{
328-
var shouldClose = EditorUtility.DisplayDialog(L10n.Tr("Warning: Deactivating a Virtual Player"),
329-
L10n.Tr("Closing this window will deactivate the virtual player. Are you sure you want to close the window?"),
330-
L10n.Tr("Close"),
331-
L10n.Tr("Keep Open"));
330+
if (MppmCloseCallback != null)
331+
return MppmCloseCallback.Invoke();
332+
return true;
333+
}
332334

333-
return shouldClose;
335+
internal static void SetMppmCanCloseCallback(Func<bool> mppmCanCloseCallback )
336+
{
337+
MppmCloseCallback = mppmCanCloseCallback;
334338
}
335339

336340
private static bool AskToClose(List<EditorWindow> allUnsaved)

Editor/Mono/EditorGUI.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,12 @@ public sealed partial class EditorGUI
3737
{
3838
private static RecycledTextEditor activeEditor;
3939

40-
internal static DelayedTextEditor s_DelayedTextEditor = new DelayedTextEditor();
40+
private static DelayedTextEditor s_DelayedTextEditorInternal;
41+
internal static DelayedTextEditor s_DelayedTextEditor => s_DelayedTextEditorInternal ??= new();
42+
43+
internal static RecycledTextEditor s_RecycledEditorInternal;
44+
internal static RecycledTextEditor s_RecycledEditor => s_RecycledEditorInternal ??= new();
4145

42-
internal static RecycledTextEditor s_RecycledEditor = new RecycledTextEditor();
4346
internal static string s_OriginalText = "";
4447
internal static string s_RecycledCurrentEditingString;
4548
private static bool bKeyEventActive = false;

Editor/Mono/Inspector/Core/PropertyEditor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ protected virtual void OnGUI()
470470
[UsedImplicitly]
471471
protected virtual void Update()
472472
{
473-
ActiveEditorTracker.Internal_GetActiveEditorsNonAlloc(tracker, s_Editors);
473+
ActiveEditorTracker.Internal_GetActiveEditorsNonAlloc(tracker, ref s_Editors);
474474
if (s_Editors.Length == 0)
475475
return;
476476

@@ -1698,7 +1698,7 @@ private void DrawPreviewAndLabels()
16981698
if (GUI.Button(foldoutRect, title, Styles.preDropDown))
16991699
{
17001700
EditorUtility.DisplayCustomMenu(foldoutRect, panelOptions, selectedPreview,
1701-
OnPreviewSelected, editorsWithPreviews);
1701+
OnPreviewSelected, editorsWithPreviews.ToArray());
17021702
}
17031703
}
17041704
else
@@ -1822,7 +1822,7 @@ private void DrawFooter()
18221822

18231823
private void OnPreviewSelected(object userData, string[] options, int selected)
18241824
{
1825-
IPreviewable[] availablePreviews = userData as IPreviewable[];
1825+
var availablePreviews = (IPreviewable[])userData;
18261826
m_SelectedPreview = availablePreviews[selected];
18271827
}
18281828

0 commit comments

Comments
 (0)