1
0
mirror of synced 2024-12-18 09:15:54 +01:00
WACVR/Assets/Script/Configuration/ComponentAutoName.cs

23 lines
627 B
C#
Raw Normal View History

2022-11-05 01:32:17 +01:00
using TMPro;
using UnityEngine;
[ExecuteAlways]
public class ComponentAutoName : MonoBehaviour
{
[Header("!Readme!")]
[TextArea]
public string Notes = "This script will automatically set the text and config key name to object name. Pls rename prefab/gameobject name.";
private TMP_Text text;
private ConfigPanelComponent configPanelComponent;
private void Awake()
{
text = GetComponentInChildren<TMP_Text>();
configPanelComponent = GetComponent<ConfigPanelComponent>();
text.text = gameObject.name;
}
void Update()
{
text.text = gameObject.name;
}
}