void Awake() { LocalizedAudioSource audioObject = ((AudioSource)target).gameObject.GetComponent <LocalizedAudioSource>(); if (audioObject != null) { selectedKey = audioObject.localizedKey; } }
void Awake() { LocalizedAudioSource audioObject = ((LocalizedAudioSource)target); if (audioObject != null) { selectedKey = audioObject.localizedKey; } }
/// <summary> /// Override of the OnInspectorGUI method /// </summary> public override void OnInspectorGUI() { base.OnInspectorGUI(); selectedKey = LocalizedKeySelector.SelectKeyGUI(selectedKey, true, LocalizedObjectType.AUDIO); if (!Application.isPlaying && GUILayout.Button("Use Key", GUILayout.Width(70))) { LocalizedAudioSource audioObject = ((LocalizedAudioSource)target); audioObject.localizedKey = selectedKey; } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); selectedKey = LocalizedKeySelector.SelectKeyGUI(selectedKey, true, LocalizedObjectType.AUDIO); if (!Application.isPlaying && GUILayout.Button("Use Key", GUILayout.Width(80))) { GameObject targetGameObject = ((AudioSource)target).gameObject; LocalizedAudioSource audioObject = targetGameObject.GetComponent <LocalizedAudioSource>(); if (audioObject == null) { audioObject = targetGameObject.AddComponent <LocalizedAudioSource>(); } audioObject.localizedKey = selectedKey; } }