SetAnchorLine.cs 854 B

1234567891011121314151617181920212223
  1. using UnityEngine;
  2. public class SetAnchorLine : MonoBehaviour
  3. {
  4. public float y;
  5. private float interval = 0.1244f;// 线段的间隔
  6. public GameObject Line;
  7. public Transform LineParent;
  8. public int count = 0;
  9. void Start()
  10. {
  11. y = (SceneIOCContainer.Instance.Pull("mesh_test") as GameObject).transform.Find("SceneRoot").localPosition.y;
  12. y = System.Math.Abs(y);
  13. while(y>LineParent.GetChild(LineParent.childCount-1).localPosition.z)
  14. {
  15. Vector3 v3 = LineParent.GetChild(LineParent.childCount - 1).localPosition;
  16. GameObject line = Instantiate(LineParent.GetChild(LineParent.childCount-1).gameObject,LineParent);
  17. count++; line.name = "Line" + count;
  18. v3.z += interval;
  19. line.transform.localPosition = v3;
  20. }
  21. }
  22. }