コード例 #1
0
    static string[] GetGUIDS(Package package, string localRootPath)
    {
        var includeProjectSettings = package.IsCompleteProjects && !s_SkipProjectSettings;
        var str1  = "Assets" + (localRootPath ?? string.Empty);
        var chars = new[] { (char)47 };
        var path1 = str1.Trim(chars);

        string[] guidArray       = null;
        object[] assetsItemArray = null;

        if (typeof(DebugUtils).Assembly.GetType("UnityEditor.AssetServer") != null)
        {
            assetsItemArray = AssetServer.BuildExportPackageAssetListAssetsItems(AssetServer.CollectAllChildren(AssetDatabase.AssetPathToGUID(path1), new string[0]), true);
        }
        else
        {
            guidArray = Packager.BuildExportPackageAssetListGuids(Packager.CollectAllChildren(AssetDatabase.AssetPathToGUID(path1), new string[0]), true);
        }
        var list = new List <string>();
        var str2 = path1.ToLower();

        if (assetsItemArray != null)
        {
            foreach (var assetsItem in assetsItemArray)
            {
                var assetGuid = assetsItem.GetFieldValue <string>("guid");
                var str3      = AssetDatabase.GUIDToAssetPath(assetGuid).ToLower();
                if (str3.StartsWith("assets/plugins") || str3.Contains("standard assets") || str3.StartsWith(str2))
                {
                    list.Add(assetGuid);
                }
            }
        }
        else
        {
            foreach (var guid in guidArray)
            {
                var str3 = AssetDatabase.GUIDToAssetPath(guid).ToLower();
                if (str3.StartsWith("assets/plugins") || str3.Contains("standard assets") || str3.StartsWith(str2))
                {
                    list.Add(guid);
                }
            }
        }
        if (includeProjectSettings)
        {
            foreach (var path2 in Directory.GetFiles("ProjectSettings"))
            {
                var str3 = AssetDatabase.AssetPathToGUID(path2);
                if (str3.Length > 0)
                {
                    list.Add(str3);
                }
            }
        }
        var array = new string[list.Count];

        list.CopyTo(array);
        return(array);
    }
コード例 #2
0
    static string[] GetGUIDS(Package package, string localRootPath)
    {
        var includeProjectSettings = package.IsCompleteProjects && !s_SkipProjectSettings;
        var str1            = "Assets" + (localRootPath ?? string.Empty);
        var chars           = new[] { (char)47 };
        var path1           = str1.Trim(chars);
        var assetsItemArray = AssetServer.BuildExportPackageAssetListAssetsItems(AssetServer.CollectAllChildren(AssetDatabase.AssetPathToGUID(path1), new string[0]), true);
        var list            = new List <string>();
        var str2            = path1.ToLower();

        foreach (var assetsItem in assetsItemArray)
        {
            var str3 = AssetDatabase.GUIDToAssetPath(assetsItem.guid).ToLower();
            if (str3.StartsWith("assets/plugins") || str3.Contains("standard assets") || str3.StartsWith(str2))
            {
                list.Add(assetsItem.guid);
            }
        }
        if (includeProjectSettings)
        {
            foreach (var path2 in Directory.GetFiles("ProjectSettings"))
            {
                var str3 = AssetDatabase.AssetPathToGUID(path2);
                if (str3.Length > 0)
                {
                    list.Add(str3);
                }
            }
        }
        var array = new string[list.Count];

        list.CopyTo(array);
        return(array);
    }