revival/game/Assets/PathCreator/Examples/Scripts/GeneratePathExample.cs

20 lines
627 B
C#

using UnityEngine;
namespace PathCreation.Examples {
// Example of creating a path at runtime from a set of points.
[RequireComponent(typeof(PathCreator))]
public class GeneratePathExample : MonoBehaviour {
public bool closedLoop = true;
public Transform[] waypoints;
void Start () {
if (waypoints.Length > 0) {
// Create a new bezier path from the waypoints.
BezierPath bezierPath = new BezierPath (waypoints, closedLoop, PathSpace.xyz);
GetComponent<PathCreator> ().bezierPath = bezierPath;
}
}
}
}