Skip to content

Instantly share code, notes, and snippets.

@baobao
Created January 18, 2017 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baobao/0030aff97085747c4db2304ee53774e3 to your computer and use it in GitHub Desktop.
Save baobao/0030aff97085747c4db2304ee53774e3 to your computer and use it in GitHub Desktop.
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);
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment