You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
681 B

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);
}
}
}
}