Splines are a great tool that can enhance how you make games. You can use them to improve game visuals or even assist with gameplay features such as making NPCs movement routes and much more. Unity now has an official spline tool which gives you the power of splines in a very simple and easy to use package. Here's how to work with splines and how you can easily use its basic components to spawn and animate objects. To install the package, open the package manager window, make sure you are filtering for Unity Registry, search for Spline and install the package. You'll need Unity2022 or higher to be able to install the splines package. To start creating a spline, right click the hierarchy and go to the spline option. Or you can use the GameObject menu on the top to do the same. You can start the spline with a few shapes or use the Draw Splines Tool to create it. By using the draw tool, you can click on the view to create spline points, called knots, and draw your spline shape. You can also click and drag while creating the knots to have more control on their curvature. When you're done, disable the draw icon or simply press enter to finish the spline creation. This will create an object with a SplineContainer component which holds the spline information. To be able to see and edit your spline, make sure the spline tool icon is enabled in the tools overlay This will display the handles and allow you to manipulate the spline. --Basic Spline manipulation There are two main ways to manipulate the spline. Clicking and dragging the blue indicator will move the knot in the XZ axis. And while holding the mouse button, you can also hold the ALT key to move it in the Y direction instead. Alternatively, you can click the knot to select it and enable the default transform handles. Here, you can move it just like any other unity object. Selecting a knot this way will display the element inspector. You can select how the spline curves are drawn here. Linear for direct lines, Auto for very rounded lines And Bezier for more refined control which will show the tangent lines that you can use to control the curves. Continuous curves will allow you to set different distances for each tangent points Choose Mirror for smooth curves, And broken for sharp turns and complete control. By setting the position handle to CENTER, You can use the rotate and scale tool to move multiple knots together. The Spline package comes with 3 different components ready to use. Spline instantiate lets you spawn objects along the spline with a lot of customization options. Add the component to the spline and Click on the + button to add a slot, and drag the object prefab you want to spawn. You can control how far apart the objects are by changing the distance. And select the checkbox below to give the spawn object an offset. Let's fix the rotation of this object now by rotating 90 degrees in the Y axis. The scale offset means how much scale is added to the object. So a scale offset of 1 will double the object size. The spawned objects rotation will be aligned to the knots rotation. With the spline tool enabled, you can select the knot and use the rotate transform to rotate the its direction. You can also randomize any offset values by selecting Random. You can use the random offset to quickly place decoration objects in your scene. If you want to rotate the spline in its local direction you can do so by selecting ELEMENT in the rotation handle. This will allow you to rotate the knot in its local directions. To showcase how to solve some common problems, let's create a tree line for our scene. Instead of setting the distance between objects you can also select Instance Count to set a fixed amount of spawns. As you can see here, the tree's will rotate to follow the spline orientation, which is not what we want in this case. To solve this, enable rotation offset and turn on Override space to world space to ignore the spline alignment. We can also add multiple prefabs to our spawns. And set the chance of them being instantiated. And as a final touch, let's just give some offset position to the tree line. The second component is the animate component Which can be used to move an object along the spline. On the object you want to move, Add the Spline animate component and assign the spline you want to follow to the slot. Use the Play button or the scroll to preview the animation. You can control the speed by changing the duration or change it to speed instead. Changing the easing will control how your animation behaves. And you can also change the loop mode to move an object back and forth. You can use splineAnimate to create routes to move objects like cameras and NPCs in your game. You can offset the animation by creating an empty parent and animate that instead. This will allow you to move the child object and offset the correct position. The extrude component will extrudes out a mesh around the spline. Adding the component will automatically add a mesh renderer to the object and It'll create a mesh file in your project that is recreated every time you change the components options. You can enable the draw tool icon to create another spline inside the same object. The new spline will be created inside the container component which can be seen on the inspector. You can display only the points of a single spline by selecting the spline inside the spline container. You can join the two splines by selecting two knots on the end points of the spline. You can select a knot and in the element inspector, press split to create split that spline into two. Use the CLOSED option to set if your splines loops or not. If you want to make intersecting roads, you can link two knots and have they move together. Select both points and click the Link button. Now you can move both roads together. You can use Unlink to undo this behavior. To create a new point in the middle of the spline, use the draw tool and click on the spline line. This will create a linked point with the new created spline. then hit ESC to cancel creation of the new spline, keeping only new knot on the curve. And that's it. The spline tool is a simple but effective tool that gives you the basic functionality to manipulate splines and comes with some components that can get your started using splines to help make your games. You can also expand upon it to make very complex and useful things. I hope you liked this, And until next time.