Exemple #1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            string[] tagNames = TagName.GetTagNames();

            if (tagNames.Length == 0)
            {
                EditorGUI.LabelField(position, ObjectNames.NicifyVariableName(property.name), "Tag is Empty");
                return;
            }

            int[] tagNumbers = new int[tagNames.Length];

            SetTagNambers(tagNumbers, tagNames);

            if (!string.IsNullOrEmpty(property.stringValue))
            {
                tagNameAttribute.selectedValue = GetIndex(tagNames, property.stringValue);
            }

            tagNameAttribute.selectedValue = EditorGUI.IntPopup(position, label.text, tagNameAttribute.selectedValue, tagNames, tagNumbers);

            property.stringValue = tagNames[tagNameAttribute.selectedValue];
        }