private void CacheLocations(IEnumerable <IResourceLocation> locations) { foreach (var location in locations) { var path = location.PrimaryKey.GetAfterFirst("/"); // Remove the addressables prefix. LocationsCache.Add(new CachedResourceLocation(path, location.ResourceType)); } }
public ProjectResourceProvider(string rootPath = null) { RootPath = rootPath; projectResources = GetProjectResources(); redirectors = new Dictionary <Type, TypeRedirector>(); foreach (var kv in projectResources) { LocationsCache.Add(new CachedResourceLocation(kv.Key, kv.Value)); } IReadOnlyDictionary <string, Type> GetProjectResources() { var filter = string.IsNullOrEmpty(RootPath) ? null : $"{RootPath}/"; return(ProjectResources.Get().GetAllResources(filter)); } }
public void RemoveResourceGuid(string path) { pathToGuidMap.Remove(path); LocationsCache.RemoveAll(r => r.Path.EqualsFast(path)); }
public void AddResourceGuid(string path, string guid) { pathToGuidMap[path] = guid; LocationsCache.Add(new CachedResourceLocation(path, typeof(UnityEngine.Object))); }