using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class ButtonTextSetter : MonoBehaviour
{
public Button button;
public string buttonText = "Click Me";
void Start()
{
if (button != null)
{
TextMeshPro textMeshPro = button.GetComponentInChildren<TextMeshPro>();
if (textMeshPro != null)
{
textMeshPro.text = buttonText;
}
else
{
Debug.LogError("TextMeshPro component not found on the button.");
}
}
else
{
Debug.LogError("Button reference not set.");
}
}
}