baobao
1/18/2017 - 5:48 PM

Require More Unity5.6.0b4

Require More Unity5.6.0b4

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;

[InitializeOnLoad]
public static class SceneEventCallback
{
    static SceneEventCallback ()
    {
        // 新規シーン作成時Callback
        EditorSceneManager.newSceneCreated += (scene, setup, mode) => {
            Debug.Log ("newSceneCreated : " + scene + " / " + setup + " / " + mode);
        };
        // Unload or Remove完了
        EditorSceneManager.sceneClosed += (scene) => {
            Debug.Log ("sceneClosed : " + scene);
        };
        // Unload or Remove中
        EditorSceneManager.sceneClosing += (scene, removingScene) => {
            Debug.Log ("sceneClosing : " + scene + " / " + removingScene);
        };
        // シーンを開いた
        EditorSceneManager.sceneOpened += (scene, mode) => {
            Debug.Log ("sceneOpened : " + scene + " / " + mode);
        };
        // シーンを開き中
        EditorSceneManager.sceneOpening += (path, mode) => {
            Debug.Log ("sceneOpening : " + path + " / " + mode);
        };
        // シーン保存完了
        EditorSceneManager.sceneSaved += (scene) => {
            Debug.Log ("sceneSaved : " + scene);
        };
        // シーン保存中
        EditorSceneManager.sceneSaving += (scene, path) => {
            Debug.Log ("sceneSaving : " + scene + " / " + path);
        };
    }
}