Skip to content

Commit f60d65e

Browse files
author
Unity Technologies
committed
Unity 6000.1.4f1 C# reference source code
1 parent 789400a commit f60d65e

39 files changed

+735
-248
lines changed

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ private enum AtlasType { Undefined = -1, Master = 0, Variant = 1 }
132132
private string m_Hash;
133133
private int m_PreviewPage = 0;
134134
private int m_TotalPages = 0;
135-
const float kPrefixLabelWidth = 290f;
136135
private int[] m_OptionValues = null;
137136
private string[] m_OptionDisplays = null;
138137
private Texture2D[] m_PreviewTextures = null;
@@ -365,9 +364,6 @@ public override void OnInspectorGUI()
365364

366365
serializedObject.Update();
367366

368-
var oldWidth = EditorGUIUtility.labelWidth;
369-
EditorGUIUtility.labelWidth = kPrefixLabelWidth;
370-
371367
HandleCommonSettingUI();
372368

373369
GUILayout.Space(EditorGUI.kSpacing);
@@ -418,7 +414,6 @@ public override void OnInspectorGUI()
418414
}
419415
}
420416

421-
EditorGUIUtility.labelWidth = oldWidth;
422417
serializedObject.ApplyModifiedProperties();
423418
}
424419

Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ private bool HasReasonToCompile()
10271027

10281028
private bool SupportsRunInBackground(NamedBuildTarget buildTarget)
10291029
{
1030-
return buildTarget == NamedBuildTarget.Standalone;
1030+
return buildTarget == NamedBuildTarget.Standalone || buildTarget == NamedBuildTarget.VisionOS;
10311031
}
10321032

10331033
private void OnPresetSelectorClosed()

Editor/Mono/Inspector/UnityEventDrawer.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,23 @@ static PersistentListenerMode GetMode(SerializedProperty mode)
369369
return (PersistentListenerMode)mode.enumValueIndex;
370370
}
371371

372+
internal static bool ShouldClearMethodAfterTargetChanged(SerializedProperty listener, Object newValue)
373+
{
374+
// If the type is the same we dont need to clear the method
375+
var typeProperty = listener.FindPropertyRelative(kInstanceTypePath);
376+
var typeString = typeProperty.stringValue;
377+
if (!string.IsNullOrEmpty(typeString))
378+
{
379+
var objType = Type.GetType(typeString, false);
380+
381+
if (objType == null || newValue == null || newValue.GetType() != objType)
382+
return true;
383+
}
384+
385+
// Clear if the value is null
386+
return newValue == null;
387+
}
388+
372389
protected virtual void DrawEvent(Rect rect, int index, bool isActive, bool isFocused)
373390
{
374391
var pListener = m_ListenersArray.GetArrayElementAtIndex(index);
@@ -396,8 +413,10 @@ protected virtual void DrawEvent(Rect rect, int index, bool isActive, bool isFoc
396413
{
397414
GUI.Box(goRect, GUIContent.none);
398415
EditorGUI.PropertyField(goRect, listenerTarget, GUIContent.none);
399-
if (EditorGUI.EndChangeCheck())
416+
if (EditorGUI.EndChangeCheck() && ShouldClearMethodAfterTargetChanged(pListener, listenerTarget.objectReferenceValue))
417+
{
400418
methodName.stringValue = null;
419+
}
401420
}
402421

403422
SerializedProperty argument = GetArgument(pListener);

Editor/Mono/RenderPipelineGraphicsSettingsCollectionPropertyDrawer.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,21 @@ void DrawHelpButton(VisualElement root, HelpURLAttribute helpURLAttribute)
8686
}
8787
}
8888

89-
void ShowContextualMenu(Rect rect, List<LeafElement<SettingsInfo>> siblings, SerializedProperty property)
89+
void ShowContextualMenu(Rect rect, List<LeafElement<SettingsInfo>> siblings)
9090
{
91-
List<IRenderPipelineGraphicsSettings> targets = new(siblings.Count);
91+
List<(IRenderPipelineGraphicsSettings target, SerializedProperty property)> targets = new(siblings.Count);
9292
foreach (SettingsInfo sibling in siblings)
93-
targets.Add(sibling.target);
93+
targets.Add((sibling.target, sibling.property));
9494

9595
var contextualMenu = new GenericMenu(); //use ImGUI for now, need to be updated later
96-
RenderPipelineGraphicsSettingsContextMenuManager.PopulateContextMenu(targets, property, ref contextualMenu);
96+
RenderPipelineGraphicsSettingsContextMenuManager.PopulateContextMenu(targets, ref contextualMenu);
9797
contextualMenu.DropDown(new Rect(rect.position + Vector2.up * rect.size.y, Vector2.zero), shouldDiscardMenuOnSecondClick: true);
9898
}
9999

100100
void DrawContextualMenuButton(VisualElement root, LeafElement<SettingsInfo> settingsInfo)
101101
{
102102
var button = new Button(Background.FromTexture2D(EditorGUIUtility.LoadIcon("pane options")));
103-
button.clicked += () => ShowContextualMenu(button.worldBound, settingsInfo.parent.content, settingsInfo.data.property);
103+
button.clicked += () => ShowContextualMenu(button.worldBound, settingsInfo.parent.content);
104104
root.Add(button);
105105
}
106106

0 commit comments

Comments
 (0)