Exemplo n.º 1
0
        void SetupLayout(SerializedObject tutorial)
        {
            // Ensure tutorial window is not open
            foreach (var window in Resources.FindObjectsOfTypeAll <TutorialWindow>())
            {
                window.Close();
            }

            Assert.That(Resources.FindObjectsOfTypeAll <TestWindow1>(), Is.Empty, "TestWindow1 is present");

            // Save current layout and use it as the tutorial layout
            m_TutorialLayoutPath = m_TempFolderPath + "/TutorialLayout.dwlt";
            WindowLayout.SaveWindowLayout(m_TutorialLayoutPath);
            AssetDatabase.Refresh();
            var tutorialLayout       = AssetDatabase.LoadAssetAtPath <UnityEngine.Object>(m_TutorialLayoutPath);
            var windowLayoutProperty = tutorial.FindProperty("m_WindowLayout");

            windowLayoutProperty.objectReferenceValue = tutorialLayout;

            // Open TestWindow1
            EditorWindow.GetWindow <TestWindow1>();

            Assert.That(Resources.FindObjectsOfTypeAll <TestWindow1>(), Is.Not.Empty, "TestWindow1 is not present");
        }
 public static void SaveWindowLayout(string path)
 {
     WindowLayout.SaveWindowLayout(path);
 }