Spline Mesher 2.0 Documentation

Preview

Asset is in development, documentation is a draft

Spline Mesher 2
Version: 2.0.0
Review

5.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.splines.mesher.runtime assembly, otherwise you won’t be able to access the namespace and classes.

Whenever using the API, ensure you add using sc.splines.mesher.runtime; to include the namespace.

Callbacks

Both the Spline Curve Mesher and Spline Fill Mesher components and classes expose two triggers, designed to facilitate custom functionality. For instance, you may want to execute certain functionality whenever the spline mesh is rebuilt.

For example:

  • Updating a navmesh after a fence has been altered.
  • (Re)spawning objects along the same spline
  • Updating game logic data that depends on the spline
  • Adding components to the created mesh segments

All in all, this is an excellent way to integrate the tool with custom workflows.

Unlike the Events exposed in the inspector callbacks are entirely code-based, and can be subscribed to. A bare bones example looks like this:

using System;
using UnityEngine;
using sc.splines.mesher.runtime;

[ExecuteAlways] //Ensure the OnEnable and OnDisable functions fire outside of play mode
public class RebuildEventExample : MonoBehaviour
{
    public SplineMesher splineMesher;

    private void OnEnable()
    {
        //Subscribe
        SplineMesher.onPostRebuildMesh += OnPostRebuild;
    }

    private void OnPostRebuild(SplineMesher instance)
    {
        //Is the instance being rebuild the one we want to work with
        if (instance == splineMesher)
        {
            //Execute something
        }
    }

    private void OnDisable()
    {
        //Unsubscribe
        SplineMesher.onPostRebuildMesh -= OnPostRebuild;
    }
}

There’s also the onPreRebuildMesh callback, that executes before the mesh is being rebuild.

Editor tools

The 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 January 23, 2026
0 of 0 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