void CheckIsValid() { if (TextLocalisation.GetLocalisedValue(instance.key) == null) { gotKey = false; } else { gotKey = true; } }
public override void OnInspectorGUI() { instance.GetComponent <TextMeshProUGUI>().text = (instance.preview && gotKey) ? TextLocalisation.GetLocalisedValue(instance.key) : instance.key; EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); instance.key = TextLocaliserEditorGUI.TextField("Localiser Key", instance.key); if (EditorGUI.EndChangeCheck()) { CheckIsValid(); EditorUtility.SetDirty(target); } EditorGUILayout.EndHorizontal(); instance.preview = EditorGUILayout.Toggle("Preview?", instance.preview); }