Пример #1
0
        /// <summary>
        /// Checks if a resource exists
        /// </summary>
        /// <remarks>
        /// <para>Note that this *can* be faster than GetResource depending on caching and backing type</para>
        /// </remarks>
        public bool ResourceExists <T>(string path, bool typeExact) where T : UnityEngine.Object
        {
            if (path.StartsWith("Game/") || path.StartsWith("Core/"))// || path.StartsWith("Addons/"))
            {
                Debug.LogWarning($"Resource path starts with special folder, this case isn't currently handled! ({path})");
            }

            string         folder  = GetFolderName(path);
            ResourceFolder rFolder = RetrieveResourceFolder(folder);
            string         file    = GetFileName(path);
            ResourceObject rObject = rFolder.RetrieveResourceObject(file);

            return(rObject.ExistsForType <T>(typeExact));
        }
Пример #2
0
        internal ResourceObject RetrieveResourceObject(string path)
        {
            ResourceObject rObject;

            if (!ResourceObjectCache.TryGetValue(path, out rObject))
            {
                string         folder  = GetFolderName(path);
                ResourceFolder rFolder = RetrieveResourceFolder(folder);
                string         file    = GetFileName(path);
                rObject = rFolder.RetrieveResourceObject(file);
                ResourceObjectCache.Add(path, rObject);
            }

            return(rObject);
        }