public void UpdateObjectsIntoCache(APAssetType type, string assetid, Queue <APAsset> modifedAssets = null) { APAsset asset = APResources.GetAPAssetByPath(type, assetid); if (APCache.HasAsset(type, assetid)) { var previousAssets = APCache.GetValue(type, assetid); if (asset != null && previousAssets != null) { asset.Used = previousAssets.Used; APCache.SetValue(type, assetid, asset); if (modifedAssets != null) { modifedAssets.Enqueue(asset); } } } }
private static void AddNewImportAssets(string assetPath) { Utility.DebugLog(string.Format("New: {0}", assetPath)); if (!File.Exists(assetPath) && Directory.Exists(assetPath)) { return; } var guid = AssetDatabase.AssetPathToGUID(assetPath); UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(assetPath, typeof(UnityEngine.Object)); APAsset asset = null; // if new path // if (obj is Texture) { if (obj is MovieTexture) { var movie = APResources.GetAPAssetByPath(APAssetType.MovieTexture, guid); if (movie != null) { APCache.SetValue(APAssetType.MovieTexture, movie.Id, movie); } SyncManager.AddedAssets.Enqueue(movie); return; } asset = APResources.GetAPAssetByPath(APAssetType.Texture, guid); if (asset != null) { APCache.SetValue(APAssetType.Texture, asset.Id, asset); } } if (asset != null) { SyncManager.AddedAssets.Enqueue(asset); } Resources.UnloadUnusedAssets(); }