Ejemplo n.º 1
0
        static void AddLocalFilesToTreeIfNotEnumerated(AddressableAssetTree tree, string path, IBuildLogger logger)
        {
            AddressableAssetTree.TreeNode pathNode = tree.FindNode(path, true);

            if (pathNode == null || pathNode.HasEnumerated) // Already enumerated
            {
                return;
            }

            pathNode.HasEnumerated = true;
            using (logger.ScopedStep(LogLevel.Info, $"Enumerating {path}"))
            {
                foreach (string filename in Directory.EnumerateFileSystemEntries(path, "*.*", SearchOption.AllDirectories))
                {
                    if (!AddressableAssetUtility.IsPathValidForEntry(filename))
                    {
                        continue;
                    }
                    string convertedPath = filename.Replace('\\', '/');
                    var    node          = tree.FindNode(convertedPath, true);
                    node.IsFolder      = AssetDatabase.IsValidFolder(filename);
                    node.HasEnumerated = true;
                }
            }
        }
Ejemplo n.º 2
0
        internal static AddressableAssetTree BuildAddressableTree(AddressableAssetSettings settings, IBuildLogger logger = null)
        {
            using (logger.ScopedStep(LogLevel.Verbose, "BuildAddressableTree"))
            {
                if (!ExtractAddressablePaths(settings, out HashSet <string> paths))
                {
                    return(null);
                }

                AddressableAssetTree tree = new AddressableAssetTree();
                foreach (string path in paths)
                {
                    AddressableAssetTree.TreeNode node = tree.FindNode(path, true);
                    node.IsAddressable = true;
                }
                return(tree);
            }
        }