private void AutoFixActiveGenerator()
 {
     if (_activeGenerator == null) {
         _templateIndex = Mathf.Clamp(_templateIndex, 0, ScriptGeneratorDescriptor.Descriptors.Count);
         _activeGenerator = ScriptGeneratorDescriptor.Descriptors[_templateIndex].CreateInstance();
     }
 }
 private void AutoFixActiveGenerator()
 {
     if (_activeGenerator == null)
     {
         _templateIndex   = Mathf.Clamp(_templateIndex, 0, ScriptGeneratorDescriptor.Descriptors.Count);
         _activeGenerator = ScriptGeneratorDescriptor.Descriptors[_templateIndex].CreateInstance();
     }
 }
        private void DrawTemplateSelector()
        {
            if (_templateDescriptions == null)
            {
                _templateDescriptions = ScriptGeneratorDescriptor.Descriptors
                                        .Select(descriptor => descriptor.Attribute.Description)
                                        .ToArray();
            }

            // Allow user to select template from popup.
            EditorGUILayout.PrefixLabel("Template:");
            EditorGUI.BeginChangeCheck();
            _templateIndex = EditorGUILayout.Popup(_templateIndex, _templateDescriptions);
            if (EditorGUI.EndChangeCheck())
            {
                _activeGenerator = null;
            }

            AutoFixActiveGenerator();
        }
        private void DrawTemplateSelector()
        {
            if (_templateDescriptions == null)
                _templateDescriptions = ScriptGeneratorDescriptor.Descriptors
                    .Select(descriptor => descriptor.Attribute.Description)
                    .ToArray();

            // Allow user to select template from popup.
            EditorGUILayout.PrefixLabel("Template:");
            EditorGUI.BeginChangeCheck();
            _templateIndex = EditorGUILayout.Popup(_templateIndex, _templateDescriptions);
            if (EditorGUI.EndChangeCheck())
                _activeGenerator = null;

            AutoFixActiveGenerator();
        }