internal void GatherAllAssetReferenceDrawableEntries(List <IReferenceEntryData> refEntries, AddressableAssetSettings settings)
        {
            var path = AssetPath;

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            if (guid == EditorSceneListName)
            {
                //We don't add Built in scenes to the list of assignable AssetReferences so no need to check this.
                return;
            }
            if (guid == ResourcesName)
            {
                //We don't add Resources assets to the list of assignable AssetReferences so no need to check this.
                return;
            }
            if (AssetDatabase.IsValidFolder(path))
            {
                foreach (var fi in AddressablesFileEnumeration.EnumerateAddressableFolder(path, settings, true))
                {
                    string relativeAddress = address + GetRelativePath(fi, path);
                    var    reference       = new ImplicitAssetEntry()
                    {
                        address       = relativeAddress,
                        AssetPath     = fi,
                        IsInResources = IsInResources,
                        labels        = new HashSet <string>(m_Labels)
                    };

                    refEntries.Add(reference);
                }
            }
#pragma warning disable 0618
            else if (MainAssetType == typeof_AddressableAssetEntryCollection)
            {
                var col = AssetDatabase.LoadAssetAtPath <AddressableAssetEntryCollection>(AssetPath);
                if (col != null)
                {
                    foreach (var e in col.Entries)
                    {
                        refEntries.Add(new ImplicitAssetEntry()
                        {
                            address       = e.address,
                            AssetPath     = e.AssetPath,
                            IsInResources = e.IsInResources,
                            labels        = new HashSet <string>(e.labels.Union(this.labels))
                        });
                    }
                }
            }
#pragma warning restore 0618
            else
            {
                refEntries.Add(this);
            }
        }
예제 #2
0
        internal void GatherAllAssetReferenceDrawableEntries(List <IReferenceEntryData> refEntries)
        {
            var path = AssetPath;

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            if (guid == EditorSceneListName)
            {
                //We don't add Built in scenes to the list of assignable AssetReferences so no need to check this.
                return;
            }
            if (guid == ResourcesName)
            {
                //We don't add Resources assets to the list of assignable AssetReferences so no need to check this.
                return;
            }
            if (AssetDatabase.IsValidFolder(path))
            {
                foreach (var fi in GetAllValidAssetPathsFromDirectory(path, true))
                {
                    string relativeAddress = address + GetRelativePath(fi, path);
                    var    reference       = new ImplicitAssetEntry()
                    {
                        address       = relativeAddress,
                        AssetPath     = fi,
                        IsInResources = IsInResources
                    };

                    refEntries.Add(reference);
                }
            }
            else if (MainAssetType == typeof(AddressableAssetEntryCollection))
            {
                var col = AssetDatabase.LoadAssetAtPath <AddressableAssetEntryCollection>(AssetPath);
                if (col != null)
                {
                    foreach (var e in col.Entries)
                    {
                        refEntries.Add(e);
                    }
                }
            }
            else
            {
                refEntries.Add(this);
            }
        }