设置路径点
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class MyPathManager : MonoBehaviour {
public static Transform[] points;
//将路径点存入输入组
void Awake(){
points = new Transform[transform.childCount];
for (int i = 0; i < points.Length; i++) {
points[i]= transform.GetChild(i);
}
}
//在编辑模式下画出路径线
void OnDrawGizmos(){
if (points == null)
return;
for (int i = 0; i < points.Length - 1 ; i++) {
Gizmos.color = Color.green;
Gizmos.DrawLine(points[i].position, points[i+1].position);
}
}
}