37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
|
|
using UnityEngine;
|
|||
|
|
using UnityEditor;
|
|||
|
|
using UnityEditor.SceneManagement;
|
|||
|
|
|
|||
|
|
[InitializeOnLoad]
|
|||
|
|
class SceneReloader : AssetPostprocessor {
|
|||
|
|
|
|||
|
|
private static bool isReload = false;
|
|||
|
|
|
|||
|
|
static SceneReloader(){
|
|||
|
|
EditorApplication.update += Update;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private static void Update(){
|
|||
|
|
if(isReload){
|
|||
|
|
isReload = false;
|
|||
|
|
EditorSceneManager.OpenScene(EditorSceneManager.GetActiveScene().path);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 反応しない
|
|||
|
|
// static void OnPreprocessAsset(){
|
|||
|
|
// isReload = true;
|
|||
|
|
// Debug.Log("PreprocessAsset");
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths){
|
|||
|
|
// 暫定対応
|
|||
|
|
// Assetインポート->Scene更新確認Dialog->更新になるので途中での保存には対処出来ない
|
|||
|
|
foreach(var importedAsset in importedAssets){
|
|||
|
|
if(importedAsset.Contains(".unity")){
|
|||
|
|
isReload = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|