public UAsset GetAsset(string assetPath, Type type) { WeakReference assetRef; UAsset asset = null; if (_assets.TryGetValue(assetPath, out assetRef) && assetRef.IsAlive) { asset = assetRef.Target as UAsset; if (asset != null) { ResourceManager.GetAnalyzer().OnAssetAccess(assetPath); return(asset); } } ResourceManager.GetAnalyzer().OnAssetOpen(assetPath); if (File.Exists(assetPath)) { asset = new UAssetDatabaseAsset(assetPath, type); } else { asset = new UFailureAsset(assetPath); } _assets[assetPath] = new WeakReference(asset); return(asset); }
public UAsset GetAsset(string assetPath, Type type, EAssetHints hints) { WeakReference assetRef; UAsset asset = null; if (_assets.TryGetValue(assetPath, out assetRef) && assetRef.IsAlive) { asset = assetRef.Target as UAsset; if (asset != null) { ResourceManager.GetAnalyzer()?.OnAssetAccess(assetPath); return(asset); } } ResourceManager.GetAnalyzer()?.OnAssetOpen(assetPath); if (Directory.Exists(assetPath)) { asset = new UAssetDatabaseFileListAsset(assetPath); } else if (IsFileExists(assetPath)) { asset = new UAssetDatabaseAsset(assetPath, type, hints, Random.Range(_asyncSimMin, _asyncSimMax)); } else { asset = new UFailureAsset(assetPath, type); } _assets[assetPath] = new WeakReference(asset); return(asset); }
public UAsset GetAsset(string assetPath) { WeakReference assetRef; UAsset asset = null; if (_assets.TryGetValue(assetPath, out assetRef) && assetRef.IsAlive) { asset = assetRef.Target as UAsset; if (asset != null) { return(asset); } } asset = new UAssetDatabaseAsset(assetPath); _assets[assetPath] = new WeakReference(asset); return(asset); }