Splines 2.6.1
I started playing with splines recently. The idea is to create a tool that generates simple structures like a scaffolding out of splines (i.e. crane beam with variable length, or procedural staircases). For that I made a script that creates zig-zag spline with given parameters: length, shape of the corners, frequency of peaks etc.
The issue #1: if the ExtrudeSpline component is attached and active, every call to `Spline.Add(float3, TangentMode) or similar methods makes the mesh to regenerate. That’s seems to generating a lot of garbage, since each and every subsequent generation takes more time and eventually freezes up the Editor.
The issue #2: If instead of Add I use AddRange, I loose control over the individual knot’s TangentMode, which leads to the need of re-assigning its value in another loop over the already generated knots, that is an individual knot operation and again, triggers the mesh regeneration.
UPD: Without the ExtrudeSpline the behavior is the same: the Editor can hang up easily on a simple spline generation. AddRange methods does not saves from it. The problem is somewhere in the Spline itself.
UPD2: That second editor hang up was on me, just poorly designed cycle where I calculated the spline shape.
The temporary solution to both issues is to disable SplineExtrude before generating spline and enabling it after. This is a minor inconvenience for those who has managed to figure out the source of an issue, but could be not obvious for beginners.
The issue #3: The Segments Per Unit property of the SplineExtrude component. Say, I have a zig-zag spline with tens of corners and Linear tangents. I would like to have enough segments on corners and no segmentation at straight sections, but I can’t. For the whole spline of many sections I need to set small enough SPU to get nice corners, but it also yields up a lot of excess triangles. It would have a lot of sense to add another optional parameter, like the minimal curvature that yields in segmentation. If a spline section does not curve enough, the section is simply not created. I looking myself into the SplineMesh class to figure out possible easy hack to implement this, but it seems like I would need to copy-paste the generation method and create my own SplineExtrude-derived or completely new component to do such generation.