public void OnInspectorGUI(string propertyPath) { EditorGUI.BeginChangeCheck(); serializedObject.Update(); var iterator = serializedObject.GetIterator(); for (bool enterChildren = true; iterator.NextVisible(enterChildren); enterChildren = false) { EditorGUILayout.PropertyField(iterator, true, new GUILayoutOption[0]); if (iterator.name == propertyPath) { var key = iterator.stringValue; var localizedString = Localization.Get(key); EditorGUILayout.LabelField("Localized Text", localizedString); if (!string.IsNullOrEmpty(key)) { if (!Localization.KeyExist(key)) { DrawAutoComplete(iterator); } } } } serializedObject.ApplyModifiedProperties(); if (EditorGUI.EndChangeCheck()) { var text = target as T; if (text != null) { text.OnLocalize(); } } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EditorGUI.BeginProperty(position, label, property); EditorGUI.BeginChangeCheck(); var keyProperty = property; EditorGUI.PropertyField(position, keyProperty, label, true); var key = keyProperty.stringValue; var localizedString = Localization.Get(key); EditorGUILayout.LabelField("Localized Text", localizedString); if (!string.IsNullOrEmpty(key)) { if (!Localization.KeyExist(key)) { DrawAutoComplete(keyProperty); } } EditorGUI.EndProperty(); }