rabidus-test/Assets/PathCreator/Examples/Scripts/GeneratePathExample.cs

20 lines
627 B
C#
Raw Normal View History

2023-07-24 16:38:13 +03: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;
}
}
}
}