📜  获取检查器的父名称统一 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:19.687000             🧑  作者: Mango

代码示例1
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using TMPro;
[ExecuteInEditMode]
public class getParentName : MonoBehaviour
{

    void LateUpdate()
    {
        var parentName = transform.parent.name;
        TextMeshProUGUI textmeshPro = GetComponent();
        textmeshPro.SetText(parentName);
    }
}