public static void DisableDirective(string directiveName)
        {
            var directives = GetDirectivesFromXmlFile();
            var directive  = directives.FirstOrDefault(d => d.name.Equals(directiveName, StringComparison.OrdinalIgnoreCase));

            if (directive == null)
            {
                Debug.LogErrorFormat("Directive '{0}' not found!", directiveName);
                return;
            }

            directive.enabled = false;
            CustomDefineManager.SaveDirectives(directives);

            // also update the editor window
            var window = Resources.FindObjectsOfTypeAll <CustomDefineManager>().LastOrDefault();

            if (window != null)
            {
                var windowDirective = window.directives.FirstOrDefault(d => d.name == directive.name);
                if (windowDirective != null)
                {
                    windowDirective.enabled = false;
                    window.Repaint();
                }
            }
        }
Example #2
0
        static void Init()
        {
            // Get existing open window or if none, make a new one:
            CustomDefineManager window = (CustomDefineManager)EditorWindow.GetWindow <CustomDefineManager>("Custom Define Manager", true, typeof(SceneView));

            window.Show();
        }