I was able to reduce the lag. As you can see in the above image, there were more wall prefabs being spawned. The track was straight, so scaling the wall length decreased the overall number of wall to be spawned. That helped in reducing the cpu usage while spawning them.
I have a doubt though from the performance doc.
In the recommended "Split Splines" method
"When a spline is used as an input for a Curvy Generator, the CG will update every time that spline is modified. That means that if you modify a kilometer long spline used for mesh extrusion, the whole mesh will be updated even if only the last meter of the spline is modified. A way to avoid this scenario would be to have a CG extruding the static part of the spline, and another one extruding the part that will be updated (that last meter)"
Can you please explain a bit more, this part "A way to avoid this scenario would be to have a CG extruding the static part of the spline, and another one extruding the part that will be updated (that last meter)" ?
I have a doubt though from the performance doc.
In the recommended "Split Splines" method
"When a spline is used as an input for a Curvy Generator, the CG will update every time that spline is modified. That means that if you modify a kilometer long spline used for mesh extrusion, the whole mesh will be updated even if only the last meter of the spline is modified. A way to avoid this scenario would be to have a CG extruding the static part of the spline, and another one extruding the part that will be updated (that last meter)"
Can you please explain a bit more, this part "A way to avoid this scenario would be to have a CG extruding the static part of the spline, and another one extruding the part that will be updated (that last meter)" ?