static void CreateWindow() { Rect rect = new Rect(0, 0, 500, 300); window = (LightingWindow)EditorWindow.GetWindowWithRect(typeof(LightingWindow), rect, true, "光照"); if (window.Init()) { window.Show(); } }
public bool Init() { string sceneConfigPath = Application.dataPath + "/" + LightingData.constConfigPath; string scenePath = Application.dataPath + "/Res/Scene/"; Scene curScene = SceneManager.GetActiveScene(); if (curScene == null) { window.Close(); window = null; UnityEditor.EditorUtility.DisplayDialog("Title", "请先打开场景", "是"); return(false); } m_sceneName = curScene.name; lightSystem = new LightSystem(new LightingData(curScene.name, sceneConfigPath, SceneTools.getConfigPath(), scenePath)); recoverSystem = new LightRecoverSystem(new LightingData(curScene.name, sceneConfigPath, SceneTools.getConfigPath(), scenePath)); lightSystem.OnInit(); Lightmapping.completed = lightSystem.BakeOver; return(true); }