public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            label = EditorGUI.BeginProperty(position, label, property);

            if (property.propertyType == SerializedPropertyType.ObjectReference)
            {
                Dictionary <string, FactionTypeInfo> factionTypeDic = RTSEditorHelper.GetFactionTypes();

                index = factionTypeDic.Values.ToList().IndexOf(property.objectReferenceValue as FactionTypeInfo);

                if (index < 0) //make sure the index value is always valid
                {
                    index = 0;
                }

                index = EditorGUI.Popup(position, label.text, index, factionTypeDic.Keys.ToArray());

                property.objectReferenceValue = factionTypeDic[factionTypeDic.Keys.ToArray()[index]] as Object;
            }
            else
            {
                EditorGUI.LabelField(position, label.text, "Use [FactionType] with object reference fields.");
            }
        }
 public void OnEnable()
 {
     target_SO = new SerializedObject(target as FactionTypeInfo);
     RTSEditorHelper.GetFactionTypes(true, target as FactionTypeInfo);
 }