Spline Mesher Pro Documentation

Spline Mesher - Pro

Spline Mesher - Pro
Version: 1.0.8
Review

4.Scripting #

Familiarity with C# and OOP programming is assumed. Support cannot be extended to coding help. Some specific functionality and use cases really need to be handled on a project-specific basis with some creative thinking.

If you are using an assembly definition, ensure you add a reference to the sc.splinemesher.pro.runtime assembly, otherwise you won’t be able to access the namespace and classes.

Whenever using the API, ensure you add using sc.splinemesher.pro.runtime; to include the namespace.

Accessing settings

Both the Spline Curve Mesher and Spline Fill Mesher components have a settings class instance, which in turn has various sub-class instances (eg. Distribution, Scale, Collider etc). They are laid out almost identically to how they’re presented in the inspector UI, so specific settings are straightforward to find.

You are encouraged to explore the settings instance in your IDE.

Press CTRL+Space after the . to explore the available fields and functions.

When changing settings in the inspector rebuilding happens automatically, but when changing them through script its required to call Rebuild() after you’ve finished making changes.

A few helper functions are in place:

Spline Curve Mesher

  • SetInputMesh(Mesh mesh)
  • AssignMaterials(Material[] materials)

Spline Fill Mesher

  • SetMaterial(Material material)

Manual rebuilding

Both the Spline Curve Mesher and Spline Fill Mesher components have a Rebuild() function, which will trigger a regeneration of the entire mesh. An option splineIndex argument can be passed on to rebuild for a specific spline.

This needs to be used when altering any component settings through script.

Be sure to call the Dispose() function where you are sure the Spline Mesher is no longer needed, this clears up memory.

Spline rebuild triggers

If you have the OnSplineAdded, OnSplineChanged or OnSplineRemoved rebuild triggers disabled, you’d also need to manage the spline cache manually through the respective AddCachedSpline, UpdateCachedSpline, RemoveCachedSpline functions.

A notification will be displayed in the inspector to also indicate this.

This is needed to update the internal spline cache, which is used for the mesh generation. Without doing so, the mesh gets rebuild based on outdated spline data.

When creating splines procedurally

Many use cases call for creating Splines from a script. For instance building pipelines or tracing a river down a mountain.

⚠️ There are some caveats, inherent to how Unity’s spline system works, that need to be taken into account however. Namely, assigning (new) splines to a Spline Container.

Don’t use SplineContainer.Spline = newSpline or SplineContainer.Splines = newSplineList. This will trigger the deletion of all the splines in the container and immediately trigger their creation again.

The Spline Mesher components reacts to these changes by default and destroys/recreates impactful resources. If this is done repeatedly it can lead to race conditions that can leave stray splines behind.

✅ Do: use SplineContainer.Spline.Copy(newSpline) (possibly in a loop). This merely changes the Spline, allowing a Spline Mesher to simply rebuild according to it.

Alternatively. Set splineMesherInstance.rebuildTriggers = RebuildTriggers.None; and only call its Rebuild() function once you’ve finished creating splines. The performance benefits are quite significant. See also the Performance Guidelines section.

Editor tools

The sc.splinemesher.pro.editor.SplineMesherEditor class contains a few public static functions, for use in custom tooling and pipelines:

  • GenerateLODS (with overloads for specific scenes and meshers)
  • GenerateLightmapUVs (with an overload for a list of meshers)
Yes No Suggest edit
Last updated on April 3, 2026
2 of 2 users found this section helpful
If you're familiar with this asset, please consider leaving a review!
Your support is what makes complementary updates possible!
Suggest Edit