コード例 #1
0
 static AssetMoveResult OnWillMoveAsset(string sourcePath, string destinationPath)
 {
     if (AssetWatcher.AssetAtPathIsGraphAsset(sourcePath))
     {
         Version++;
     }
     return(AssetMoveResult.DidNotMove);
 }
コード例 #2
0
 static AssetDeleteResult OnWillDeleteAsset(string assetPath, RemoveAssetOptions options)
 {
     if (AssetWatcher.AssetAtPathIsGraphAsset(assetPath))
     {
         Version++;
     }
     return(AssetDeleteResult.DidNotDelete);
 }
コード例 #3
0
        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);
            };
        }