public static WindowBase GenerateScreen(string filepath, string className, FlowLayoutWindowTypeTemplate template)
        {
            WindowBase instance = null;

            filepath = filepath.Replace("//", "/");

            var sourcepath = ADB.GetAssetPath(template);

            filepath = AssetDatabase.GenerateUniqueAssetPath(filepath);

            System.IO.File.Copy(sourcepath, filepath, true);
            ADB.Refresh();

            var source = ADB.LoadAssetAtPath(filepath, typeof(GameObject)) as GameObject;
            var prefab = source.GetComponent <WindowBase>();

            instance = UnityEditor.PrefabUtility.InstantiatePrefab(prefab) as WindowBase;

            var type = WindowUtilities.GetTypeFromAllAssemblies(className);

            instance = FlowDatabase.ReplaceComponents <FlowLayoutWindowTypeTemplate, WindowBase>(instance as FlowLayoutWindowTypeTemplate, type);

            FlowDatabase.SaveScreen(instance);

            GameObject.DestroyImmediate(instance.gameObject);
            instance = (ADB.LoadAssetAtPath(filepath, typeof(GameObject)) as GameObject).GetComponent <WindowBase>();

            return(instance);
        }
        public static WindowLayout GenerateLayout(string filepath, FlowWindowLayoutTemplate layout)
        {
            filepath = filepath.Replace("//", "/");

            WindowLayout instance = null;

            var sourcepath = ADB.GetAssetPath(layout);

            filepath = AssetDatabase.GenerateUniqueAssetPath(filepath);

            System.IO.File.Copy(sourcepath, filepath, true);
            ADB.Refresh();

            var source = ADB.LoadAssetAtPath(filepath, typeof(GameObject)) as GameObject;
            var prefab = source.GetComponent <WindowLayout>();

            instance = UnityEditor.PrefabUtility.InstantiatePrefab(prefab) as WindowLayout;

            instance = FlowDatabase.ReplaceComponents <FlowWindowLayoutTemplate, WindowLayout>(instance as FlowWindowLayoutTemplate, typeof(WindowLayout));

            FlowDatabase.SaveLayout(instance);

            GameObject.DestroyImmediate(instance.gameObject);
            instance = (ADB.LoadAssetAtPath(filepath, typeof(GameObject)) as GameObject).GetComponent <WindowLayout>();

            return(instance);
        }