Search Unity

Building better paths while maintaining creative flow with Splines in 2022.2

December 12, 2022 in Engine & platform | 8 min. read
Building better paths while maintaining creative flow with Splines in 2022.2 | Hero image
Building better paths while maintaining creative flow with Splines in 2022.2 | Hero image
Share

Is this article helpful for you?

Thank you for your feedback!

Unity 2022.2 includes updates to the Splines package, accessible through the Package Manager, which offers you the ability to draw and use spline paths in your game or other creation. For developers, this means you can easily build out rivers, roads, camera tracks, and other path-related features and tools. If you’re an artist, you get a consistent, Unity-supported experience across all these toolsets using our Splines solution. Several default components are also included with the Splines package, so you can use this new artist tooling right away.

If you’d like to jump right into learning and discussing the new Splines package, head over to the Unity Splines forum post.

What is a spline?

A “spline” is a type of path that is often used in both 3D and 2D creative tools. Essentially, you set a few points as if you are mapping out a road, then optionally tweak how the path curves around those points, and, finally, connect more branching points if you need them… that’s your spline!

A basic spline path, drawn in Unity
A basic spline path, drawn in Unity

Splines are often used to:

  • Create rivers and roads
  • Set camera tracks
  • Define areas or shapes
Several spline uses – a road through a forest, an animation path, tubes, or wire meshes
Several spline uses – a road through a forest, an animation path, tubes, or wire meshes

Ok, so what is the Splines package?

The Splines package enables you to create and use splines as easily as you would any other object. Open the GameObject menu to create a spline, then add whatever components you want to use that spline’s path.

As an artist, this means you just need to learn one set of tools to draw roads onto your terrain, define camera paths, or extrude mesh shapes for level design. Even better, the spline you draw for your camera can be reused to place a path on the ground, to navigate characters, or anything else. Just add or swap out components as needed.

For developers, the Splines package provides a robust and standardized framework to build on. Create your own custom components or Unity Asset Store packages. For more information, see the Splines API documentation.

Great! How can I get started?

Create or open a project on Unity 2022.2 or later, then install the Splines package using the Package Manager.

To create a spline:

  1. From the top menu, select Create > Spline > Draw Spline.
  2. Click in the Scene view to place points for your spline. If you want to add a curve to the path, click and drag when you place a point.
  3. When you are done drawing, press Escape, or select a tool in the Tools overlay.
  4. Use the Editor’s standard select and transformation tools to edit the shape of the spline. 

For more information, see the Splines documentation.

Contextual workflows

Splines is the first major feature to use our new tooling system, contextual workflows. Contextual workflows use overlays to get you the right tools at the right time. You can see them in action in these cases:

  • Simplify editing with Tool context: Select a spline to see an icon appear at the beginning of the Tools overlay. This icon indicates the Tool overlay’s Tool context. Click the Tool context icon to change your Tool context from GameObject to Spline. Now you can dive right into editing the spline’s finer details using the standard Editor tools and controls.
  • Customize with Tool Settings: Activate a spline tool to see new options in the Tool Settings overlay. This shows you which options are available so you can pick what you need on the fly.
  • Discover new tools with component tools: Select a spline, and if that spline has any component tools, they appear at the bottom of the Tools overlay. If a package or asset uses components to add new tools, you can find them at the bottom of the Tools overlay – no need to search through the Editor.

The best part here is that contextual tooling can work with any toolset in Unity, including the Unity Asset Store or other custom creations. If you’re a tool developer and need help setting this up, start with the tools documentation, or reach out on the Unity Forums.

Editing, tools, and options will appear dynamically, based on your selection
Editing, tools, and options will appear dynamically, based on your selection

Components included in splines

Speaking of components, we’ve included three to meet the common uses cases:

  • Instantiate: Generate copies of an item along a spline. Use the Instantiate component to create objects like fences, trees, stone walkways, and so on.
  • Animate: Move a GameObject along a spline. Use the Animate component with cameras, characters, or in situations where you need to define movement in Unity.
  • Extrude: Build a tube mesh along a spline. Use the Extrude component to create and easily edit shapes like wires, pipes, ropes, noodles, and more.
The “Instantiate” component is used to build a fence along a spline.
The “Instantiate” component is used to build a fence along a spline.

New features, tools and options for artists

Branching

New in Splines 2.1, you can build splines with multiple, branching paths. Activate the Draw Splines tool, and begin drawing new parts onto the spline. This also enables you to create disconnected spline sections.

Spline segments can be drawn as branching or even disconnected parts
Spline segments can be drawn as branching or even disconnected parts

Direct manipulation

You can directly manipulate splines quickly without having to hunt through menus for the right transform tool or gizmo. When you are editing spline points, click-drag a point to move it. No tool activation needed! This is designed to bring 2D-like simplicity of editing to splines.

Click and drag to immediately move the element, no selection or handles required
Click and drag to immediately move the element, no selection or handles required

Parent and Element handle modes

When editing spline points, these new options are available in the handle orientation dropdown. Parent enables you to move, rotate, or scale items relative to their parent element. Element gives you precise editing using the selected item’s directionality.

Splines includes new tool options for more precise editing
Splines includes new tool options for more precise editing

API and samples for developers

Splines was built to be a foundation for other tooling, especially tools from the Unity Asset Store and custom creations. The package includes a robust API and samples for developers to learn from or customize. Check out the Splines API documentation to get started.

Discussion and feedback

The Splines package has been publicly available for almost a year now. Your continuous input has been fantastic, and we’re excited to hear even more, especially from artists, with this major update. Comments here are great, and for deeper discussions we hope to see you on the Splines forum thread.

December 12, 2022 in Engine & platform | 8 min. read

Is this article helpful for you?

Thank you for your feedback!

Related Posts