You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
802 B
33 lines
802 B
2 years ago
|
using UnityEngine;
|
||
|
using UnityEditor;
|
||
|
using UnityEditor.UI;
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
|
||
|
namespace UIWidgets {
|
||
|
[CustomEditor(typeof(TabIconButton), true)]
|
||
|
[CanEditMultipleObjects]
|
||
|
public class TabIconButtonEditor : ButtonEditor {
|
||
|
Dictionary<string,SerializedProperty> serializedProperties = new Dictionary<string,SerializedProperty>();
|
||
|
|
||
|
string[] properties = new string[]{
|
||
|
"Name",
|
||
|
"Icon",
|
||
|
};
|
||
|
|
||
|
protected override void OnEnable()
|
||
|
{
|
||
|
Array.ForEach(properties, x => serializedProperties.Add(x, serializedObject.FindProperty(x)));
|
||
|
|
||
|
base.OnEnable();
|
||
|
}
|
||
|
|
||
|
public override void OnInspectorGUI()
|
||
|
{
|
||
|
serializedProperties.ForEach(x => EditorGUILayout.PropertyField(x.Value));
|
||
|
serializedObject.ApplyModifiedProperties();
|
||
|
|
||
|
base.OnInspectorGUI();
|
||
|
}
|
||
|
}
|
||
|
}
|