static AssetMoveResult OnWillMoveAsset(string sourcePath, string destinationPath) { if (AssetWatcher.AssetAtPathIsGraphAsset(sourcePath)) { Version++; } return(AssetMoveResult.DidNotMove); }
static AssetDeleteResult OnWillDeleteAsset(string assetPath, RemoveAssetOptions options) { if (AssetWatcher.AssetAtPathIsGraphAsset(assetPath)) { Version++; } return(AssetDeleteResult.DidNotDelete); }
static AssetWatcher() { s_Instance = new AssetWatcher(); Instance.m_ProjectAssetPaths = new Dictionary <string, string>(); var graphAssetGUIDs = AssetDatabase.FindAssets("t:" + typeof(VSGraphAssetModel).Name); foreach (var guid in graphAssetGUIDs) { var path = AssetDatabase.GUIDToAssetPath(guid); var graphAssetModel = AssetDatabase.LoadMainAssetAtPath(path) as GraphAssetModel; s_Instance.WatchGraphAssetAtPath(path, graphAssetModel); } // TODO: be smarter AssetDatabase.importPackageCompleted += name => { EditorReducers.BuildAll(null); }; }