using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class PlayerLocationDisplay : MonoBehaviour
{
//Define serialized TMP_Text for TextMeshPro
[SerializeField] private TMP_Text locationText;
///
/// This method runs when the game first starts
/// and it calls on the Update Location Text method.
///
private void Start()
{
UpdateLocationText();
}
///
/// This method Updates the text that displays the
/// player's location to the player.
///
public void UpdateLocationText()
{
//Get the name of the current scene or level
string currentSceneName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
//Update the TMP_Text with the scene name
locationText.text = "Location: " + currentSceneName;
}
}