1
0
mirror of synced 2024-11-27 23:50:50 +01:00
WACVR/Assets/Script/Configuration/ComponentAutoName.cs
2022-11-05 01:32:17 +01:00

23 lines
627 B
C#

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;
}
}