Esempio n. 1
0
        /// <summary>
        /// Draw a searchable color field with a reset button for a color setting
        /// </summary>
        /// <param name="property">The setting property of the target setting</param>
        /// <param name="origColor">The original color value</param>
        /// <param name="searchContext">The search context</param>
        /// <returns>
        /// The specified color in the color field
        /// </returns>
        private static Color ColorProperty(
            SettingsProperty <Color> property, Color origColor, string searchContext)
        {
            var color = origColor;

            using (new EditorGUILayout.HorizontalScope()) {
                color = SettingsGUILayout.SearchableColorField(
                    new GUIContent(property.label, property.tooltip),
                    color, searchContext);

                if (GUILayout.Button("Reset", GUILayout.Width(50)))
                {
                    color = property.defaultValue;
                }
            }

            return(color);
        }