static string[] OnWillSaveAssets(string[] paths)
        {
            if (paths.Any(p => Path.GetExtension(p) == ".unity" &&
                          !string.IsNullOrEmpty(Path.GetFileNameWithoutExtension(p))))
            {
                // Build All VS, before returning.
                EditorReducers.BuildAll(null);
            }
            if (paths.Any(AssetWatcher.AssetAtPathIsGraphAsset))
            {
                Version++;
            }

            return(paths);
        }
Пример #2
0
 public void RegisterReducers()
 {
     // Register reducers.
     UIReducers.Register(this);
     EditorReducers.Register(this);
     GraphAssetReducers.Register(this);
     GraphReducers.Register(this);
     StackReducers.Register(this);
     NodeReducers.Register(this);
     PlacematReducers.Register(this);
     PortalReducers.Register(this);
     EdgeReducers.Register(this);
     VariableReducers.Register(this);
     PropertiesReducers.Register(this);
     StickyNoteReducers.Register(this);
 }
        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);
            };
        }