using UnityEngine; public class SetAnchorLine : MonoBehaviour { public float y; private float interval = 0.1244f;// 线段的间隔 public GameObject Line; public Transform LineParent; public int count = 0; void Start() { y = (SceneIOCContainer.Instance.Pull("mesh_test") as GameObject).transform.Find("SceneRoot").localPosition.y; y = System.Math.Abs(y); while(y>LineParent.GetChild(LineParent.childCount-1).localPosition.z) { Vector3 v3 = LineParent.GetChild(LineParent.childCount - 1).localPosition; GameObject line = Instantiate(LineParent.GetChild(LineParent.childCount-1).gameObject,LineParent); count++; line.name = "Line" + count; v3.z += interval; line.transform.localPosition = v3; } } }