Esempio n. 1
0
        /// <summary>
        /// Attempts to load all the available resources (optionally) filtered by a base path and holds each of them.
        /// </summary>
        public static async UniTask <IReadOnlyCollection <Resource> > LoadAndHoldAllAsync <TResource> (this IResourceLoader <TResource> loader, object holder, string path = null)
            where TResource : UnityEngine.Object
        {
            var resources = await loader.LoadAllAsync(path);

            foreach (var resource in resources)
            {
                var localPath = loader.GetLocalPath(resource);
                if (!string.IsNullOrEmpty(localPath))
                {
                    loader.Hold(localPath, holder);
                }
            }
            return(resources);
        }