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

20 lines
627 B
C#
Raw Normal View History

2021-03-12 15:33:05 +01:00
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;
}
}
}
}