@@ -77,88 +77,90 @@ private void OnMenuInit()
7777                } 
7878                else  if  ( itemIndex  ==  1 ) 
7979                { 
80-                     var  settings  =  AddressableAssetSettingsDefaultObject . Settings ; 
81-                     if  ( settings  !=  null ) 
82-                     { 
83-                         string  binPath  =  ContentUpdateScript . GetContentStateDataPath ( false ) ; 
84-                         if  ( _config  !=  null  &&  _config . Count  >  0 ) 
85-                         { 
86-                             for  ( int  i  =  0 ;  i  <  _config . Count ;  i ++ ) 
87-                             { 
88-                                 JsonData  item  =  _config [ i ] ; 
89-                                 string  groupName  =  item [ "GroupName" ] . ToString ( ) ; 
90-                                 var  group  =  settings . FindGroup ( groupName ) ; 
91-                                 if  ( group  ==  null ) 
92-                                 { 
93-                                     group  =  settings . CreateGroup ( groupName , false , false , false , null ) ; 
94-                                 } 
80+                     AddressablesEditor . SetAddressablesAssets ( ) ; 
81+                     EditorApplication . ExecuteMenuItem ( "Window/Asset Management/Addressables/Groups" ) ; 
82+                     //var settings = AddressableAssetSettingsDefaultObject.Settings; 
83+                     //if (settings != null) 
84+                     //{ 
85+                     //    string binPath = ContentUpdateScript.GetContentStateDataPath(false); 
86+                     //    if (_config != null && _config.Count > 0) 
87+                     //    { 
88+                     //        for (int i = 0; i < _config.Count; i++) 
89+                     //        { 
90+                     //            JsonData item = _config[i]; 
91+                     //            string groupName = item["GroupName"].ToString(); 
92+                     //            var group = settings.FindGroup(groupName); 
93+                     //            if (group == null) 
94+                     //            { 
95+                     //                group = settings.CreateGroup(groupName,false,false,false,null); 
96+                     //            } 
9597
96-                                 ContentUpdateGroupSchema  cugSchema  =  group . GetSchema < ContentUpdateGroupSchema > ( ) ; 
97-                                 if  ( cugSchema  ==  null ) 
98-                                 { 
99-                                     cugSchema  =  group . AddSchema < ContentUpdateGroupSchema > ( ) ; 
100-                                 } 
101-                                 cugSchema . StaticContent  =  ( ( int ) item [ "UpdateRestriction" ]  ==  1 ) ; 
102-                                 BundledAssetGroupSchema  bagSchema  = group . GetSchema < BundledAssetGroupSchema > ( ) ; 
103-                                 if  ( bagSchema  ==  null ) 
104-                                 { 
105-                                     bagSchema =  group . AddSchema < BundledAssetGroupSchema > ( ) ; 
106-                                 } 
107-                                 bagSchema . BuildPath . SetVariableByName ( settings ,  item [ "BuildPath" ] . ToString ( ) ) ; 
108-                                 bagSchema . LoadPath . SetVariableByName ( settings ,  item [ "LoadPath" ] . ToString ( ) ) ; 
109-                                 if  ( cugSchema . StaticContent ) 
110-                                 { 
111-                                     bagSchema . UseAssetBundleCrc  =  false ; 
112-                                     bagSchema . UseAssetBundleCrcForCachedBundles  =  false ; 
113-                                 } 
98+                     //             ContentUpdateGroupSchema cugSchema = group.GetSchema<ContentUpdateGroupSchema>();
99+                     //             if (cugSchema == null)
100+                     //             {
101+                     //                 cugSchema = group.AddSchema<ContentUpdateGroupSchema>();
102+                     //             }
103+                     //             cugSchema.StaticContent = ((int)item["UpdateRestriction"] == 1);
104+                     //             BundledAssetGroupSchema bagSchema =group.GetSchema<BundledAssetGroupSchema>();
105+                     //             if (bagSchema == null)
106+                     //             {
107+                     //                 bagSchema= group.AddSchema<BundledAssetGroupSchema>();
108+                     //             }
109+                     //             bagSchema.BuildPath.SetVariableByName(settings, item["BuildPath"].ToString());
110+                     //             bagSchema.LoadPath.SetVariableByName(settings, item["LoadPath"].ToString());
111+                     //             if (cugSchema.StaticContent)
112+                     //             {
113+                     //                 bagSchema.UseAssetBundleCrc = false;
114+                     //                 bagSchema.UseAssetBundleCrcForCachedBundles = false;
115+                     //             }
114116
115-                                 //Filter 
116-                                 StringBuilder  filterBuilder  =  new  StringBuilder ( ) ; 
117-                                 for  ( int  filterIndex  =  0 ;  filterIndex  <  item [ "Filter" ] . Count ;  filterIndex ++ ) 
118-                                 { 
119-                                     filterBuilder . Append ( $ "t:{ item [ "Filter" ] [ filterIndex ] . ToString ( ) }  ") ; 
120-                                 } 
121-                                 //SearchInFolders 
122-                                 List < string >  folders  =  new  List < string > ( ) ; 
123-                                 for  ( int  folderIndex  =  0 ;  folderIndex  <  item [ "SearchInFolders" ] . Count ;  folderIndex ++ ) 
124-                                 { 
125-                                     folders . Add ( item [ "SearchInFolders" ] [ folderIndex ] . ToString ( ) ) ; 
126-                                 } 
127-                                 //Labels 
128-                                 List < string >  labels  =  new  List < string > ( ) ; 
129-                                 for  ( int  labelIndex  =  0 ;  labelIndex  <  item [ "Labels" ] . Count ;  labelIndex ++ ) 
130-                                 { 
131-                                     labels . Add ( item [ "Labels" ] [ labelIndex ] . ToString ( ) ) ; 
132-                                 } 
117+                     //             //Filter
118+                     //             StringBuilder filterBuilder = new StringBuilder();
119+                     //             for (int filterIndex = 0; filterIndex < item["Filter"].Count; filterIndex++)
120+                     //             {
121+                     //                 filterBuilder.Append($"t:{item["Filter"][filterIndex].ToString()} ");
122+                     //             }
123+                     //             //SearchInFolders
124+                     //             List<string> folders = new List<string>();
125+                     //             for (int folderIndex = 0; folderIndex < item["SearchInFolders"].Count; folderIndex++)
126+                     //             {
127+                     //                 folders.Add(item["SearchInFolders"][folderIndex].ToString());
128+                     //             }
129+                     //             //Labels
130+                     //             List<string> labels = new List<string>();
131+                     //             for (int labelIndex = 0; labelIndex < item["Labels"].Count; labelIndex++)
132+                     //             {
133+                     //                 labels.Add(item["Labels"][labelIndex].ToString());
134+                     //             }
133135
134-                                 //Find All Asset 
135-                                 var  findAssets  =  AssetDatabase . FindAssets ( filterBuilder . ToString ( ) ,  folders . ToArray ( ) ) ; 
136-                                 for  ( int  findIndex  =  0 ;  findIndex  <  findAssets . Length ;  findIndex ++ ) 
137-                                 { 
138-                                     string  guid  =  findAssets [ findIndex ] ; 
139-                                     string  assetPath  =  AssetDatabase . GUIDToAssetPath ( guid ) ; 
140-                                     if  ( AssetDatabase . IsValidFolder ( assetPath ) ||  assetPath . EndsWith ( ".cs" ) ) 
141-                                     { 
142-                                         continue ; 
143-                                     } 
144-                                     var  entry  =  group . GetAssetEntry ( guid ) ; 
145-                                     if  ( entry  ==  null ) 
146-                                     { 
147-                                         entry  =  settings . CreateOrMoveEntry ( guid ,  group ) ; 
148-                                     } 
149-                                     entry . labels . Clear ( ) ; 
150-                                     foreach  ( var  itemLabel  in  labels ) 
151-                                     { 
152-                                         entry . SetLabel ( itemLabel ,  true ) ; 
153-                                     } 
154-                                 } 
155-                             } 
156-                         } 
157-                         EditorUtility . SetDirty ( settings ) ; 
158-                         AssetDatabase . Refresh ( ) ; 
136+                     //             //Find All Asset
137+                     //             var findAssets = AssetDatabase.FindAssets(filterBuilder.ToString(), folders.ToArray());
138+                     //             for (int findIndex = 0; findIndex < findAssets.Length; findIndex++)
139+                     //             {
140+                     //                 string guid = findAssets[findIndex];
141+                     //                 string assetPath = AssetDatabase.GUIDToAssetPath(guid);
142+                     //                 if (AssetDatabase.IsValidFolder(assetPath)|| assetPath.EndsWith(".cs"))
143+                     //                 {
144+                     //                     continue;
145+                     //                 }
146+                     //                 var entry = group.GetAssetEntry(guid);
147+                     //                 if (entry == null)
148+                     //                 {
149+                     //                     entry = settings.CreateOrMoveEntry(guid, group);
150+                     //                 }
151+                     //                 entry.labels.Clear();
152+                     //                 foreach (var itemLabel in labels)
153+                     //                 {
154+                     //                     entry.SetLabel(itemLabel, true);
155+                     //                 }
156+                     //             }
157+                     //         }
158+                     //     }
159+                     //     EditorUtility.SetDirty(settings);
160+                     //     AssetDatabase.Refresh();
159161
160-                         EditorApplication . ExecuteMenuItem ( "Window/Asset Management/Addressables/Groups" ) ; 
161-                     } 
162+                     //     EditorApplication.ExecuteMenuItem("Window/Asset Management/Addressables/Groups");
163+                     // }
162164                } 
163165                else 
164166                { 
0 commit comments