Ejemplo n.º 1
0
        /// <summary>
        /// Attempts to load a resource with the provided path and holds it in case it's loaded successfully.
        /// </summary>
        public static async UniTask <Resource <TResource> > LoadAndHoldAsync <TResource> (this IResourceLoader <TResource> loader, string path, object holder)
            where TResource : UnityEngine.Object
        {
            var resource = await loader.LoadAsync(path);

            if (loader.IsLoaded(path))
            {
                loader.Hold(path, holder);
            }
            return(resource);
        }