public static void EditorInit() { KiteSettings settings = GetOrCreateSettings(); Dir4Settings.OnEditorInit(settings); DirXSettings.OnEditorInit(settings); DirYSettings.OnEditorInit(settings); TileHelpers.OnSettings(settings); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { bool isSettings = property.serializedObject.targetObject is KiteSettings; if (isSettings) { EditorGUI.PropertyField(position, property, label); return; } if (!DirYSettings.IsInitialized()) { DirYSettings.Initialize(); } if (!initialized) { Initialize(); } Rect valuePosition = EditorGUI.PrefixLabel(position, new GUIContent(property.displayName)); DirY[] values = DirY.GetList(); DirY value = property.objectReferenceValue as DirY; if (value != null) { int currentIndex = Array.IndexOf(values, value); if (currentIndex != -1) { EditorGUI.BeginChangeCheck(); int selectedIndex = EditorGUI.IntPopup(valuePosition, currentIndex, optionLabels, optionValues); if (EditorGUI.EndChangeCheck()) { property.objectReferenceValue = values[selectedIndex]; } return; } } property.objectReferenceValue = values[0]; }