示例#1
0
 internal static IEnumerable <ExportPackageItem> GetAssetItemsForExport(ICollection <string> guids, bool includeDependencies)
 {
     if (guids.Count == 0)
     {
         string[] collection = new string[0];
         guids = new HashSet <string>(AssetDatabase.CollectAllChildren(AssetDatabase.assetFolderGUID, collection));
     }
     ExportPackageItem[] source = PackageUtility.BuildExportPackageItemsList(guids.ToArray <string>(), includeDependencies);
     if (includeDependencies)
     {
         if (source.Any((ExportPackageItem asset) => InternalEditorUtility.IsScriptOrAssembly(asset.assetPath)))
         {
             source = PackageUtility.BuildExportPackageItemsList(guids.Union(InternalEditorUtility.GetAllScriptGUIDs()).ToArray <string>(), includeDependencies);
         }
     }
     return((from val in source
             where val.assetPath != "Assets"
             select val).ToArray <ExportPackageItem>());
 }
        internal static IEnumerable <ExportPackageItem> GetAssetItemsForExport(ICollection <string> guids, bool includeDependencies)
        {
            // if nothing is selected, export all
            if (0 == guids.Count)
            {
                string[] temp = new string[0]; // <--- I dont get this API
                guids = new HashSet <string>(AssetDatabase.CollectAllChildren(AssetDatabase.assetFolderGUID, temp));
            }

            ExportPackageItem[] assets = PackageUtility.BuildExportPackageItemsListWithPackageManagerWarning(guids.ToArray(), includeDependencies, true);

            // If any scripts are included, add all scripts with dependencies
            if (includeDependencies && assets.Any(asset => UnityEditorInternal.InternalEditorUtility.IsScriptOrAssembly(asset.assetPath)))
            {
                assets = PackageUtility.BuildExportPackageItemsListWithPackageManagerWarning(
                    guids.Union(UnityEditorInternal.InternalEditorUtility.GetAllScriptGUIDs()).ToArray(), includeDependencies, true);
            }

            // If the user exports the root Assets folder, we need to remove it from the list
            // explicitly, as it doesnt make sense
            assets = assets.Where(val => val.assetPath != "Assets").ToArray();

            return(assets);
        }