protected override void DrawGUI(Rect position, Config config, bool labelClicked)
            {
                //Check if any feature within that Foldout are enabled, and show different color if so
                var hasToggledFeatures = false;
                var i = Array.IndexOf(Template.CurrentTemplate.uiFeatures, this);

                if (i >= 0)
                {
                    for (i++; i < Template.CurrentTemplate.uiFeatures.Length; i++)
                    {
                        var uiFeature = Template.CurrentTemplate.uiFeatures[i];
                        if (uiFeature is UIFeature_DropDownEnd)
                        {
                            break;
                        }

                        hasToggledFeatures |= uiFeature.Highlighted(config) && uiFeature.Enabled(config);
                    }
                }

                var color = GUI.color;

                GUI.color *= EditorGUIUtility.isProSkin ? Color.white : new Color(.95f, .95f, .95f, 1f);
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                GUI.color = color;
                EditorGUI.BeginChangeCheck();
                {
                    var rect = GUILayoutUtility.GetRect(EditorGUIUtility.fieldWidth, EditorGUIUtility.fieldWidth, EditorGUIUtility.singleLineHeight, EditorGUIUtility.singleLineHeight, TCP2_GUI.HeaderDropDownBold);

                    // hover
                    TCP2_GUI.DrawHoverRect(rect);

                    foldout = TCP2_GUI.HeaderFoldoutHighlight(rect, foldout, guiContent, hasToggledFeatures);
                    FoldoutStack.Push(foldout);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    UpdatePersistentState();

                    if (Event.current.alt || Event.current.control)
                    {
                        var state = foldout;
                        foreach (var dd in AllDropDowns)
                        {
                            dd.foldout = state;
                            dd.UpdatePersistentState();
                        }
                    }
                }
            }
                public void ShowGUILayout(int index, ButtonClick onAdd, ButtonClick onRemove)
                {
                    var guiColor = GUI.color;

                    GUI.color *= EditorGUIUtility.isProSkin || HasErrors ? Color.white : new Color(.75f, .75f, .75f, 1f);
                    var style = EditorStyles.helpBox;

                    if (HasErrors)
                    {
                        style = expanded ? TCP2_GUI.ErrorPropertyHelpBoxExp : TCP2_GUI.ErrorPropertyHelpBox;
                    }
                    EditorGUILayout.BeginVertical(style);
                    GUI.color = guiColor;

                    using (new SGUILayout.IndentedLine(16))
                    {
                        const float buttonWidth = 20;

                        var rect       = EditorGUILayout.GetControlRect(GUILayout.Height(EditorGUIUtility.singleLineHeight));
                        var guiContent = new GUIContent(string.Format("{0} ({1})", Label, implementationTypeLabel));
                        rect.width -= buttonWidth * 2;

                        // hover
                        TCP2_GUI.DrawHoverRect(rect);

                        EditorGUI.BeginChangeCheck();
                        expanded = EditorGUI.Foldout(rect, expanded, guiContent, true, TCP2_GUI.HeaderDropDown);
                        if (EditorGUI.EndChangeCheck())
                        {
                            if (Event.current.alt || Event.current.control)
                            {
                                var state = expanded;
                                foreach (var cmp in ShaderGenerator2.CurrentConfig.CustomMaterialProperties)
                                {
                                    cmp.expanded = state;
                                }
                            }
                        }

                        rect.x     += rect.width;
                        rect.width  = buttonWidth;
                        rect.height = EditorGUIUtility.singleLineHeight;
                        if (GUI.Button(rect, "+", EditorStyles.miniButtonLeft))
                        {
                            onAdd(index);
                        }
                        rect.x += rect.width;
                        if (GUI.Button(rect, "-", EditorStyles.miniButtonRight))
                        {
                            onRemove(index);
                        }

                        var labelWidth = TCP2_GUI.HeaderDropDown.CalcSize(guiContent).x;
                        rect        = GUILayoutUtility.GetLastRect();
                        rect.y     += 2;
                        rect.x     += labelWidth;
                        rect.width -= labelWidth;
                        GUI.Label(rect, ": " + PropertyName, SGUILayout.Styles.GrayMiniLabel);
                    }

                    if (expanded)
                    {
                        GUILayout.Space(4);

                        implementation.NewLineGUI(false);
                    }

                    EditorGUILayout.EndVertical();
                }