Path Creation
In the Editor
In most cases, paths are created in the editor by placing waypoints using the WaypointManager
component. Placing waypoints in 3D was already covered in the Getting Started section. 2D path creation is just as easy as that. In 2D mode, you won't need background objects with colliders, because waypoints will be placed at zero depth by default. To enable 2D placement, switch to 2D mode and let the WaypointManager
detect the placement mode.
The WaypointManager
has a dropdown for selecting path types: Standard or Bezier.
- Standard paths only consist of waypoints, and the movement script then interpolates between them.
- Bezier paths have additional controls per waypoint, the so-called control points. While these give you more flexibility in defining the shape of the path, they are a bit more complex to set up in the editor and at runtime. You can also define the detail of the whole path or each segment separately by specifying the amount of path points.
At Runtime
At runtime you can either instantiate a pre-defined path prefab into your scene, or set up a completely new path. Remember that when creating a path programmatically, based on the path component, you need to either add waypoint game objects (Standard) or waypoint and additional control point game objects (Bezier) in order to create a path.
For a sample on how to create paths programmatically, please visit the example scene Example7_Runtime.