public T RequestAssetAtPath <T>(string path) where T : UnityEngine.Object { Assert.IsNotNull(m_SuperAsset, "Must be a SuperAsset type if we are requesting dependencies"); // Is the asset in our cache? path = path.SanitizePath(); var key = new KeyValuePair <string, Type>(path.ToLower(), typeof(T)); UnityEngine.Object cachedObject; if (m_CachedDatabase.TryGetValue(key, out cachedObject)) { return(cachedObject as T); } // The path is either relative to our asset path or is absolute using (new ChDir(assetPath)) { path = Path.GetFullPath(path); if (AssetPath.TryAbsoluteToAsset(ref path)) { // Keep track that the the asset is a dependency m_SuperAsset.AddDependency(AssetImportContext, path); // In most cases our dependency is already known by the AssetDatabase T asset = AssetDatabase.LoadAssetAtPath <T>(path); if (asset != null) { // Add the asset to our cache for next time it is requested m_CachedDatabase[key] = asset; return(asset); } else { ReportMissingFile(path); } } } return(null); }
public void AddAssetPathDependency(string assetPath) { m_SuperAsset.AddDependency(assetPath); }
public void AddAssetPathDependency(string assetPath) { m_SuperAsset.AddDependency(AssetImportContext, assetPath); }