Overview
This lecture introduces Unity's official spline tool, explaining how to install, create, and manipulate splines for object spawning, animation, and mesh extrusion in game development.
Installing and Creating Splines
- Open Package Manager, filter by Unity Registry, search for "Spline," and install (requires Unity2022+).
- Create a spline by right-clicking the Hierarchy or using the GameObject menu Spline option.
- Use drawing tools to add spline points called "knots" and shape the curve.
Manipulating Splines and Knots
- Move knots on the XZ axis by dragging; hold ALT to move along the Y axis.
- Select knots to access transform handles and edit positions like regular objects.
- Spline curves can be set to Linear, Auto, or Bezier for varying control over curvature.
- Adjust tangent types: Continuous, Mirror, or Broken for different curve behaviors.
- Set Position Handle to CENTER to manipulate multiple knots together.
Spline Components
- Spline Instantiate spawns prefabs along the spline; control object distance, rotation, scale, and randomization.
- Use Instance Count to set the number of spawned objects, or Rotation Offset to adjust prefab alignment.
- Add multiple prefabs with spawn probability for diversity.
- Override space to world space to prevent objects from rotating with spline orientation.
Animation and Mesh Extrusion
- Spline Animate moves objects along a spline; assign the spline, adjust speed, duration, easing, and loop modes.
- Offset animations by parenting objects as needed.
- Extrude Component creates meshes along splines, auto-adding mesh renderer and saving mesh files.
Advanced Spline Editing
- Draw new splines inside the container or display and manipulate splines individually.
- Join or split splines by linking/unlinking knots, or splitting at selected points.
- Set splines to loop by using the CLOSED option.
- Create new knots on existing splines by clicking with the draw tool.
Key Terms & Definitions
- Spline — A smooth, curved line defined by points (knots) for shaping paths in a scene.
- Knot — A control point on a spline to define its shape.
- SplineContainer — Unity component that holds spline data.
- Prefab — A reusable Unity object template.
- Tangent — A handle used to control the curvature at each knot.
- Bezier Curve — A type of curve offering fine control via tangents.
Action Items / Next Steps
- Install the Spline package in Unity2022 or higher.
- Practice creating and editing splines and knots.
- Experiment with Spline Instantiate, Animate, and Extrude components on a test scene.