You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
911 B
C#
36 lines
911 B
C#
using UnityEditor;
|
|
using UnityEditor.SceneManagement;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
namespace MalbersAnimations
|
|
{
|
|
[InitializeOnLoad]
|
|
public static class SceneEditorManager
|
|
{
|
|
// constructor
|
|
static SceneEditorManager()
|
|
{
|
|
EditorSceneManager.sceneOpened += SceneOpenedCallback;
|
|
}
|
|
|
|
static void SceneOpenedCallback(Scene _scene, UnityEditor.SceneManagement.OpenSceneMode _mode)
|
|
{
|
|
if (!string.IsNullOrEmpty(_scene.name))
|
|
{
|
|
|
|
var allGO = _scene.GetRootGameObjects();
|
|
|
|
foreach (var go in allGO)
|
|
{
|
|
var iscene = go.GetComponent<IScene>();
|
|
|
|
if (iscene != null)
|
|
{
|
|
iscene.SceneLoaded();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |