Пример #1
0
        private void OnGUI()
        {
            EditorGUILayout.LabelField(Content.Title, Styles.Title);

            EditorGUILayout.Space();

            script = (MonoScript)EditorGUILayout.ObjectField(Content.Script, script, typeof(MonoScript), false);

            var isValidScript = EditorGenerator.IsValidMonoScript(script);

            if (script != null && !isValidScript)
            {
                EditorGUILayout.HelpBox(Content.InvalidScriptWarning, MessageType.Error);
            }

            using (new EditorGUI.DisabledGroupScope(!isValidScript))
            {
                if (GUILayout.Button("Generate"))
                {
                    generator.Create(script);
                    EditorGUIUtility.PingObject(generator.Save());

                    Debug.Log($"<b>Don't forget to remove GUI attributes from {script.name}.</b> If you don't, they'll be drawn by the custom editor <i>and</i> the attributes.");
                }
            }
        }
Пример #2
0
 private void OnEnable()
 {
     generator = new EditorGenerator();
 }