01-24-2018, 08:20 PM
In this post, I will give an explanation to your performance issues, and then a workaround.
The explanation: The curvy generator does virtually nothing until one of its inputs changes, at which point it generates the related data. In your case, changing the world position or rotation of the spline makes the spline notify the generator that it has changed, even if the changed information (the world position) is irrelevant to the generator, thus making the generator regenerate everything at each frame. I need to work on a smarter way to keep track of changes, one that makes the distinction between irrelevant changes and relevant one. So until such thing is released in an upcoming update, here is ...
The workaround: Disable the "Check Transform" setting in your splines. This will stop the splines from being updated automatically (in play mode). You will then need to make them update whenever you change their shape by calling the Refresh() method. Here is an example where I update the position of the last point of a spline:
Your issue with the spline lagging by one frame might also be fixed by the Refresh call.
If you still have performance issues, and made sure you don't generate unnecessary data for your use case (colliders, normals, tangents, etc), you can send me one of your scenes so I can profile it and pinpoint where the performance issues come from.
The explanation: The curvy generator does virtually nothing until one of its inputs changes, at which point it generates the related data. In your case, changing the world position or rotation of the spline makes the spline notify the generator that it has changed, even if the changed information (the world position) is irrelevant to the generator, thus making the generator regenerate everything at each frame. I need to work on a smarter way to keep track of changes, one that makes the distinction between irrelevant changes and relevant one. So until such thing is released in an upcoming update, here is ...
The workaround: Disable the "Check Transform" setting in your splines. This will stop the splines from being updated automatically (in play mode). You will then need to make them update whenever you change their shape by calling the Refresh() method. Here is an example where I update the position of the last point of a spline:
Code:
curvySpline.ControlPoints.Last().localPosition += Vector3.forward;
curvySpline.Refresh();
Your issue with the spline lagging by one frame might also be fixed by the Refresh call.
If you still have performance issues, and made sure you don't generate unnecessary data for your use case (colliders, normals, tangents, etc), you can send me one of your scenes so I can profile it and pinpoint where the performance issues come from.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.