This code does not work, unless, I put it into a co-routine with a 0.1f second wait.
Code:
// Create the spline
var GENERATOR = CurvyGenerator.Create();
var SHAPE = Rails[0].CopyTo(GENERATOR);
var PATH = GENERATOR.AddModule<InputSplinePath>();
var EXTRUSION = GENERATOR.AddModule<BuildShapeExtrusion>();
var VOLUME = GENERATOR.AddModule<BuildVolumeMesh>();
VOLUME.SetMaterial(0, RailMaterials[1]);
VOLUME.MaterialSetttings[0].KeepAspect = CGKeepAspectMode.ScaleU;
var MESH = GENERATOR.AddModule<CreateMesh>();
// Wire the Generator Parts
PATH.OutputByName["Path"].LinkTo(EXTRUSION.InputByName["Path"]);
SHAPE.OutputByName["Shape"].LinkTo(EXTRUSION.InputByName["Cross"]);
EXTRUSION.OutputByName["Volume"].LinkTo(VOLUME.InputByName["Volume"]);
VOLUME.OutputByName["VMesh"].LinkTo(MESH.InputByName["VMesh"]);
// Create the spline
PATH.Spline = CurvySpline.Create();
GENERATOR.Initialize(true);
// ... logic to add points to SPLINE
GENERATOR.Refresh(true);
var CREATED_MESH = MESH.SaveToScene(myGameObject.transform);
// CREATED_MESH is null