using System.Collections; using System.Collections.Generic; using UnityEngine; public class Wirepoint : MonoBehaviour { [ContextMenu("Rename")] void ResetName() { Te root = GetComponentInParent(); int index = int.Parse(root.name.Split('#')[0]); string XiangWei = transform.parent.name.Remove(2); transform.GetChild(0).name = (index - 1) + "-" + index + "_"+ XiangWei + "_End"; FindObjectOfType().EndPoints.Add(transform.GetChild(0).gameObject); transform.GetChild(1).name = index + "-" + (index + 1) + "_" + XiangWei + "_Start"; FindObjectOfType().StartPoints.Add(transform.GetChild(1).gameObject); } }