コード例 #1
0
        private string GetEntry(int idx, string label, string currentValue)
        {
            var val = EditorGUILayout.TextField(label, currentValue);

            if (EditorUtilities.IsReservedWord(val))
            {
                var style = new GUIStyle(GUI.skin.label);
                style.normal.textColor = Color.red;
                EditorGUILayout.LabelField("The above word is a reserved word, please choose another.", style);
                _isValid = false;
            }
            else if (!string.IsNullOrEmpty(val) && Array.IndexOf(_entries, val) != idx)
            {
                var style = new GUIStyle(GUI.skin.label);
                style.normal.textColor = Color.red;
                EditorGUILayout.LabelField("The above word already exists in this set, please choose another.", style);
                _isValid = false;
            }

            return(val);
        }