@@ -194,11 +194,14 @@ static void InternalReflection()
194
194
. GetFields ( BindingFlags . NonPublic | BindingFlags . Instance )
195
195
. Single ( field => field . Name . Contains ( nameof ( m_Rows ) ) ) ;
196
196
}
197
+
197
198
public static IEnumerable GetAllSceneHierarchyWindows ( ) => GetAllSceneHierarchyWindowsDelegate ( ) ;
198
199
199
- public static void DisplayObjectContextMenu ( Rect rect , UnityEngine . Object unityObject , int value ) => DisplayObjectContextMenuDelegate ( rect , unityObject , value ) ;
200
+ public static void DisplayObjectContextMenu ( Rect rect , UnityEngine . Object unityObject , int value ) =>
201
+ DisplayObjectContextMenuDelegate ( rect , unityObject , value ) ;
200
202
201
- public static bool IconSelectorShowAtPosition ( GameObject gameObject , Rect rect , bool value ) => IconSelectorShowAtPositionDelegate ( gameObject , rect , value ) ;
203
+ public static bool IconSelectorShowAtPosition ( GameObject gameObject , Rect rect , bool value ) =>
204
+ IconSelectorShowAtPositionDelegate ( gameObject , rect , value ) ;
202
205
203
206
private static MethodInfo GetItemAndRowIndexMethod ;
204
207
private static PropertyInfo m_TreeView_IData ;
@@ -695,16 +698,22 @@ void CustomRowBackground()
695
698
if ( currentEvent . type != EventType . Repaint )
696
699
return ;
697
700
698
- HierarchySettings . InstantBackgroundColor instantBackgroundColor = new HierarchySettings . InstantBackgroundColor ( ) ;
701
+ HierarchySettings . InstantBackgroundColor instantBackgroundColor =
702
+ new HierarchySettings . InstantBackgroundColor ( ) ;
699
703
bool contain = false ;
700
704
for ( int i = 0 ; i < settings . instantBackgroundColors . Count ; ++ i )
701
705
{
702
706
if ( ! settings . instantBackgroundColors [ i ] . active ) continue ;
703
707
if
704
708
(
705
- ( settings . instantBackgroundColors [ i ] . useTag && ! string . IsNullOrEmpty ( settings . instantBackgroundColors [ i ] . tag ) && rowItem . gameObject . CompareTag ( settings . instantBackgroundColors [ i ] . tag ) ) ||
706
- ( settings . instantBackgroundColors [ i ] . useLayer && ( 1 << rowItem . gameObject . layer & settings . instantBackgroundColors [ i ] . layer ) != 0 ) ||
707
- ( settings . instantBackgroundColors [ i ] . useStartWith && ! string . IsNullOrEmpty ( settings . instantBackgroundColors [ i ] . startWith ) && rowItem . name . StartsWith ( settings . instantBackgroundColors [ i ] . startWith ) )
709
+ ( settings . instantBackgroundColors [ i ] . useTag &&
710
+ ! string . IsNullOrEmpty ( settings . instantBackgroundColors [ i ] . tag ) &&
711
+ rowItem . gameObject . CompareTag ( settings . instantBackgroundColors [ i ] . tag ) ) ||
712
+ ( settings . instantBackgroundColors [ i ] . useLayer &&
713
+ ( 1 << rowItem . gameObject . layer & settings . instantBackgroundColors [ i ] . layer ) != 0 ) ||
714
+ ( settings . instantBackgroundColors [ i ] . useStartWith &&
715
+ ! string . IsNullOrEmpty ( settings . instantBackgroundColors [ i ] . startWith ) &&
716
+ rowItem . name . StartsWith ( settings . instantBackgroundColors [ i ] . startWith ) )
708
717
)
709
718
{
710
719
contain = true ;
@@ -834,7 +843,8 @@ void DisplayCustomObjectIcon(Texture icon)
834
843
if ( icon == null )
835
844
{
836
845
icon = AssetPreview . GetMiniThumbnail ( rowItem . gameObject ) ;
837
- if ( icon . name == "GameObject Icon" || icon . name == "d_GameObject Icon" || icon . name == "Prefab Icon" ||
846
+ if ( icon . name == "GameObject Icon" || icon . name == "d_GameObject Icon" ||
847
+ icon . name == "Prefab Icon" ||
838
848
icon . name == "d_Prefab Icon" || icon . name == "PrefabModel Icon" ||
839
849
icon . name == "d_PrefabModel Icon" )
840
850
return ;
@@ -1442,7 +1452,7 @@ void DirtyScene(Scene scene)
1442
1452
1443
1453
bool IsFirstRow ( Rect rect ) => rect . y / rect . height == 0 ;
1444
1454
1445
- int GetRowIndex ( Rect rect ) => ( int ) ( rect . y / rect . height ) ;
1455
+ int GetRowIndex ( Rect rect ) => ( int ) ( rect . y / rect . height ) ;
1446
1456
1447
1457
bool InSelection ( int ID ) => Selection . Contains ( ID ) ? true : false ;
1448
1458
@@ -1783,18 +1793,19 @@ internal static class Styles
1783
1793
internal static GUIStyle Header = new GUIStyle ( TreeBoldLabel )
1784
1794
{
1785
1795
richText = true ,
1786
- normal = new GUIStyleState ( ) { textColor = Color . white }
1796
+ normal = new GUIStyleState ( ) { textColor = Color . white }
1787
1797
} ;
1788
1798
1799
+ // Unity 2022+
1789
1800
internal static GUIStyle TreeBoldLabel
1790
1801
{
1791
- get { return UnityEditor . IMGUI . Controls . TreeView . DefaultStyles . boldLabel ; }
1802
+ get { return EditorStyles . boldLabel ; } // can also use UIElementsStyleHelper.GetBoldStyle()
1792
1803
}
1793
1804
1794
- internal static GUIStyle TreeLabel = new GUIStyle ( UnityEditor . IMGUI . Controls . TreeView . DefaultStyles . label )
1805
+ internal static GUIStyle TreeLabel = new GUIStyle ( EditorStyles . label )
1795
1806
{
1796
1807
richText = true ,
1797
- normal = new GUIStyleState ( ) { textColor = Color . white }
1808
+ normal = new GUIStyleState ( ) { textColor = Color . white }
1798
1809
} ;
1799
1810
}
1800
1811
@@ -1863,7 +1874,8 @@ static void QuickSiblingUp()
1863
1874
var index = gameObject . transform . GetSiblingIndex ( ) ;
1864
1875
if ( index > 0 )
1865
1876
{
1866
- Undo . SetTransformParent ( gameObject . transform , gameObject . transform . parent , string . Format ( "{0} Parenting" , gameObject . name ) ) ;
1877
+ Undo . SetTransformParent ( gameObject . transform , gameObject . transform . parent ,
1878
+ string . Format ( "{0} Parenting" , gameObject . name ) ) ;
1867
1879
1868
1880
gameObject . transform . SetSiblingIndex ( -- index ) ;
1869
1881
}
@@ -1879,7 +1891,8 @@ static void QuickSiblingDown()
1879
1891
if ( gameObject == null )
1880
1892
return ;
1881
1893
1882
- Undo . SetTransformParent ( gameObject . transform , gameObject . transform . parent , string . Format ( "{0} Parenting" , gameObject . name ) ) ;
1894
+ Undo . SetTransformParent ( gameObject . transform , gameObject . transform . parent ,
1895
+ string . Format ( "{0} Parenting" , gameObject . name ) ) ;
1883
1896
1884
1897
var index = gameObject . transform . GetSiblingIndex ( ) ;
1885
1898
gameObject . transform . SetSiblingIndex ( ++ index ) ;
@@ -1891,7 +1904,8 @@ static void QuickSiblingDown()
1891
1904
[ MenuItem ( "Tools/Hierarchy 2/Separator" , priority = 0 ) ]
1892
1905
static void CreateHeaderInstance ( UnityEditor . MenuCommand command )
1893
1906
{
1894
- GameObject gameObject = new GameObject ( string . Format ( "{0}Separator" , HierarchyEditor . instance . settings . separatorStartWith ) ) ;
1907
+ GameObject gameObject = new GameObject ( string . Format ( "{0}Separator" ,
1908
+ HierarchyEditor . instance . settings . separatorStartWith ) ) ;
1895
1909
1896
1910
Undo . RegisterCreatedObjectUndo ( gameObject , "Create Separator" ) ;
1897
1911
// Don't create headers as children of the selected objects because only root headers are drawn with background
0 commit comments