public void Draw(GUIContent label, Rect r, Rect visibleArea, string tooltip, bool includeChildren) { r.xMin += EditorGUI.indent; var prefabStage = PrefabStageUtility.GetCurrentPrefabStage(); m_IsNotInPrefabContextModeWithOverrides = prefabStage == null || prefabStage.mode != PrefabStage.Mode.InContext || !PrefabStage.s_PatchAllOverriddenProperties || Selection.objects.All(obj => PrefabUtility.IsPartOfAnyPrefab(obj) && !AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(obj)).Equals(AssetDatabase.AssetPathToGUID(prefabStage.assetPath))); m_ReorderableList.draggable = m_Reorderable && m_IsNotInPrefabContextModeWithOverrides; Rect headerRect = new Rect(r.x, r.y, r.width, m_HeaderHeight); Rect sizeRect = new Rect(headerRect.xMax - Constants.kArraySizeWidth - EditorGUI.indent * EditorGUI.indentLevel, headerRect.y, Constants.kArraySizeWidth + EditorGUI.indent * EditorGUI.indentLevel, m_HeaderHeight); Event evt = Event.current; EventType prevType = evt.type; if (!string.IsNullOrEmpty(tooltip) && prevType == EventType.Repaint) { bool hovered = headerRect.Contains(evt.mousePosition); if (hovered && GUIClip.visibleRect.Contains(evt.mousePosition)) { if (!GUIStyle.IsTooltipActive(tooltip)) { s_ToolTipRect = new Rect(evt.mousePosition, Vector2.zero); } GUIStyle.SetMouseTooltip(tooltip, s_ToolTipRect); } } if (Event.current.type == EventType.MouseUp && sizeRect.Contains(Event.current.mousePosition)) { Event.current.type = EventType.Used; } EditorGUI.BeginChangeCheck(); if (!m_OriginalProperty.hasMultipleDifferentValues) { EditorGUI.BeginProperty(headerRect, GUIContent.none, m_OriginalProperty); } bool prevEnabled = GUI.enabled; GUI.enabled = true; Property.isExpanded = EditorGUI.BeginFoldoutHeaderGroup(headerRect, Property.isExpanded, label ?? GUIContent.Temp(Property.displayName)); EditorGUI.EndFoldoutHeaderGroup(); GUI.enabled = prevEnabled; if (!m_OriginalProperty.hasMultipleDifferentValues) { EditorGUI.EndProperty(); } if (EditorGUI.EndChangeCheck()) { if (Event.current.alt) { EditorGUI.SetExpandedRecurse(Property, Property.isExpanded); } m_ReorderableList.InvalidateCacheRecursive(); } DrawChildren(r, headerRect, sizeRect, visibleArea, prevType); }