using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; namespace MoreMountains.Tools { /// /// This component, when added on a Text component, will display the name of the level /// public class MMSceneName : MonoBehaviour { protected Text _text; /// /// On Awake, stores the Text component /// protected virtual void Awake() { _text = this.gameObject.GetComponent(); } /// /// On Start, sets the level name /// protected virtual void Start() { SetLevelNameText(); } /// /// Assigns the level name to the Text /// public virtual void SetLevelNameText() { if (_text != null) { _text.text = SceneManager.GetActiveScene().name; } } } }