26 lines
757 B
C#
26 lines
757 B
C#
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
public class FGAssetModificationProcessor : UnityEditor.AssetModificationProcessor {
|
|
static string[] OnWillSaveAssets(string[] paths) {
|
|
foreach (GameObject obj in GameObject.FindGameObjectsWithTag("Generator")) {
|
|
Lorax Lorax = obj.GetComponent<Lorax>();
|
|
Lorax.DestroyGenerated();
|
|
}
|
|
|
|
EditorApplication.update += RefreshScene;
|
|
|
|
return paths;
|
|
}
|
|
|
|
static void RefreshScene() {
|
|
EditorApplication.update -= RefreshScene;
|
|
|
|
foreach (GameObject obj in GameObject.FindGameObjectsWithTag("Generator")) {
|
|
Lorax Lorax = obj.GetComponent<Lorax>();
|
|
Lorax.DestroyGenerated();
|
|
Lorax.Generate();
|
|
}
|
|
}
|
|
}
|