void Awake() { LocalizedGUIText textObject = ((GUIText)target).gameObject.GetComponent <LocalizedGUIText>(); if (textObject != null) { selectedKey = textObject.localizedKey; } }
void Awake() { LocalizedGUIText textObject = ((LocalizedGUIText)target); if (textObject != null) { selectedKey = textObject.localizedKey; } }
/// <summary> /// Override of the OnInspectorGUI method /// </summary> public override void OnInspectorGUI() { base.OnInspectorGUI(); selectedKey = LocalizedKeySelector.SelectKeyGUI(selectedKey, true, LocalizedObjectType.STRING); if (!Application.isPlaying && GUILayout.Button("Use Key", GUILayout.Width(70))) { LocalizedGUIText textObject = ((LocalizedGUIText)target); textObject.localizedKey = selectedKey; } }
/// <summary> /// Override of the OnInspectorGUI method /// </summary> public override void OnInspectorGUI() { base.OnInspectorGUI(); selectedKey = LocalizedKeySelector.SelectKeyGUI(selectedKey, true, LocalizedObjectType.STRING); if (!Application.isPlaying && GUILayout.Button("Use Key", GUILayout.Width(70))) { LocalizedGUIText textObject = ((LocalizedGUIText)target); textObject.localizedKey = selectedKey; EditorUtility.SetDirty(textObject);// ADDED to have new value serialized } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); selectedKey = LocalizedKeySelector.SelectKeyGUI(selectedKey, true, LocalizedObjectType.STRING); if (!Application.isPlaying && GUILayout.Button("Use Key", GUILayout.Width(70))) { GameObject targetGameObject = ((GUIText)target).gameObject; LocalizedGUIText textObject = targetGameObject.GetComponent <LocalizedGUIText>(); if (textObject == null) { textObject = targetGameObject.AddComponent <LocalizedGUIText>(); } textObject.localizedKey = selectedKey; } }