@@ -36,7 +36,7 @@ public static void CollapseFolders()
3636 {
3737 object assetTree = projectWindow . GetType ( ) . GetField ( "m_AssetTree" , MxEditorUtil . INSTANCE_FLAGS ) . GetValue ( projectWindow ) ;
3838 if ( assetTree != null )
39- MxEditorUtil . CollapseTreeViewController ( projectWindow , assetTree , ( TreeViewState ) projectWindow . GetType ( ) . GetField ( "m_AssetTreeState" , MxEditorUtil . INSTANCE_FLAGS ) . GetValue ( projectWindow ) ) ;
39+ MxEditorUtil . CollapseTreeViewController ( projectWindow , assetTree , ( TreeViewState < int > ) projectWindow . GetType ( ) . GetField ( "m_AssetTreeState" , MxEditorUtil . INSTANCE_FLAGS ) . GetValue ( projectWindow ) ) ;
4040
4141 object folderTree = projectWindow . GetType ( ) . GetField ( "m_FolderTree" , MxEditorUtil . INSTANCE_FLAGS ) . GetValue ( projectWindow ) ;
4242 if ( folderTree != null )
@@ -45,16 +45,16 @@ public static void CollapseFolders()
4545 int searchFiltersRootInstanceID = ( int ) typeof ( EditorWindow ) . Assembly . GetType ( "UnityEditor.SavedSearchFilters" ) . GetMethod ( "GetRootInstanceID" , MxEditorUtil . STATIC_FLAGS ) . Invoke ( null , null ) ;
4646 bool isSearchFilterRootExpanded = ( bool ) treeViewDataSource . GetType ( ) . GetMethod ( "IsExpanded" , MxEditorUtil . INSTANCE_FLAGS , null , new System . Type [ ] { typeof ( int ) } , null ) . Invoke ( treeViewDataSource , new object [ ] { searchFiltersRootInstanceID } ) ;
4747
48- MxEditorUtil . CollapseTreeViewController ( projectWindow , folderTree , ( TreeViewState ) projectWindow . GetType ( ) . GetField ( "m_FolderTreeState" , MxEditorUtil . INSTANCE_FLAGS ) . GetValue ( projectWindow ) , isSearchFilterRootExpanded ? new int [ 1 ] { searchFiltersRootInstanceID } : null ) ;
48+ MxEditorUtil . CollapseTreeViewController ( projectWindow , folderTree , ( TreeViewState < int > ) projectWindow . GetType ( ) . GetField ( "m_FolderTreeState" , MxEditorUtil . INSTANCE_FLAGS ) . GetValue ( projectWindow ) , isSearchFilterRootExpanded ? new int [ 1 ] { searchFiltersRootInstanceID } : null ) ;
4949
5050 // Preserve Assets and Packages folders' expanded states because they aren't automatically preserved inside ProjectBrowserColumnOneTreeViewDataSource.SetExpandedIDs
5151 // https://github.com/Unity-Technologies/UnityCsReference/blob/e740821767d2290238ea7954457333f06e952bad/Editor/Mono/ProjectBrowserColumnOne.cs#L408-L420
52- InternalEditorUtility . expandedProjectWindowItems = ( int [ ] ) treeViewDataSource . GetType ( ) . GetMethod ( "GetExpandedIDs" , MxEditorUtil . INSTANCE_FLAGS ) . Invoke ( treeViewDataSource , null ) ;
52+ InternalEditorUtility . expandedProjectWindowItemIds = ( EntityId [ ] ) treeViewDataSource . GetType ( ) . GetMethod ( "GetExpandedIDs" , MxEditorUtil . INSTANCE_FLAGS ) . Invoke ( treeViewDataSource , null ) ;
5353
54- TreeViewItem rootItem = ( TreeViewItem ) treeViewDataSource . GetType ( ) . GetField ( "m_RootItem" , MxEditorUtil . INSTANCE_FLAGS ) . GetValue ( treeViewDataSource ) ;
54+ TreeViewItem < int > rootItem = ( TreeViewItem < int > ) treeViewDataSource . GetType ( ) . GetField ( "m_RootItem" , MxEditorUtil . INSTANCE_FLAGS ) . GetValue ( treeViewDataSource ) ;
5555 if ( rootItem . hasChildren )
5656 {
57- foreach ( TreeViewItem item in rootItem . children )
57+ foreach ( TreeViewItem < int > item in rootItem . children )
5858 EditorPrefs . SetBool ( "ProjectBrowser" + item . displayName , ( bool ) treeViewDataSource . GetType ( ) . GetMethod ( "IsExpanded" , MxEditorUtil . INSTANCE_FLAGS , null , new System . Type [ ] { typeof ( int ) } , null ) . Invoke ( treeViewDataSource , new object [ ] { item . id } ) ) ;
5959 }
6060 }
0 commit comments