using System.Collections; using System.Collections.Generic; using UnityEngine; [ExecuteInEditMode] public class LineWay : MonoBehaviour { public Transform[] points; public bool isDraw=true; private void Update() { points = new Transform[transform.childCount]; for (int i = 0; i < points.Length; i++) { points[i] = transform.GetChild(i).transform; } if (isDraw) { if (points.Length <1) return; for (int i = 0; i < points.Length-1; i++) { Debug.DrawLine(points[i].position, points[i + 1].position, Color.green); } } } }