//自动查找 Group 配置插入到assetGroups 执行显示
        public void AutoFindGroup()
        {
            string[]          assetPaths = AssetDatabaseUtil.FindAssets <AssetGroup>();
            List <AssetGroup> groupList  = new List <AssetGroup>();

            foreach (var assetPath in assetPaths)
            {
                AssetGroup group = AssetDatabase.LoadAssetAtPath <AssetGroup>(assetPath);
                if (group != null && group.m_AssetAssemblyType == (AssetAssemblyType)m_AssetAssemblyType.intValue) //资源集合类型一致
                {
                    if (group.name.IndexOf(m_TestGroupPrefix.stringValue) == 0)
                    {
                        continue;
                    }

                    groupList.Add(group);
                }
            }
            m_AssetGroups.ClearArray();
            for (int i = 0; i < groupList.Count; ++i)
            {
                m_AssetGroups.InsertArrayElementAtIndex(i);                                  //插入
                m_AssetGroups.GetArrayElementAtIndex(i).objectReferenceValue = groupList[i]; //引用赋值
            }

            serializedObject.ApplyModifiedProperties();
        }
Example #2
0
 /// <summary>
 /// 根据配置的AssetAddressAssembly更新资源的分组
 /// </summary>
 public static void UpdateTagConfig()
 {
     string[] settingPaths = AssetDatabaseUtil.FindAssets <AssetAddressAssembly>();
     if (settingPaths == null || settingPaths.Length == 0)
     {
         Debug.LogError("AssetBundleSchemaUtil::UpdateTagConfigBySchema->Not found schema Setting;");
         return;
     }
     foreach (var assetPath in settingPaths)
     {
         AssetAddressAssembly aaAssembly = AssetDatabase.LoadAssetAtPath <AssetAddressAssembly>(assetPath);
         if (aaAssembly != null)
         {
             aaAssembly.AutoFind();
             aaAssembly.Execute();
         }
     }
 }