03-17-2016, 01:03 PM
Hi Roger
I have 2484 connections to be precise. I'm actually not sure if my stack overflow issue is specific to Curvy or Unity itself. I first tried adding a custom connection component to each CurvySplineSegment (i.e. control point), but the result here was the same with the scene playing fine in the editor but causing a StackOverflowException when building.
I have now resorted to creating a dictionary on scene load with an entry for each control point in the scene. For each control point in the dictionary I have a simple wrapper class holding references to control points that should connect to this control point. I use the InstanceID of each control point to perform a fast lookup in the dictionary whenever I reach a control point, and this is working well for me so far.
I'm not exactly sure what you mean by "permanently enabled animation feature", but because I have so many splines in the scene I was having performance issues from the CPU overhead of all the splines having their update methods invoked each frame. Since all splines in my scene are static this overhead is not necessary.
To remove the update calls I've wrapped the three update methods in CurvySpline.cs in a conditional define so that they are only run in the Unity editor (i.e. #if UNITY_EDITOR). On scene load I then manually call update on each spline a single time to initialize them which allows the SplineController to navigate the spline network.
If the Curvy authors are reading this, It would be nice with official support for this last step of eliminating the update calls for static splines, to avoid having to implement the workaround whenever the package is updated
Best regards
Christian
I have 2484 connections to be precise. I'm actually not sure if my stack overflow issue is specific to Curvy or Unity itself. I first tried adding a custom connection component to each CurvySplineSegment (i.e. control point), but the result here was the same with the scene playing fine in the editor but causing a StackOverflowException when building.
I have now resorted to creating a dictionary on scene load with an entry for each control point in the scene. For each control point in the dictionary I have a simple wrapper class holding references to control points that should connect to this control point. I use the InstanceID of each control point to perform a fast lookup in the dictionary whenever I reach a control point, and this is working well for me so far.
I'm not exactly sure what you mean by "permanently enabled animation feature", but because I have so many splines in the scene I was having performance issues from the CPU overhead of all the splines having their update methods invoked each frame. Since all splines in my scene are static this overhead is not necessary.
To remove the update calls I've wrapped the three update methods in CurvySpline.cs in a conditional define so that they are only run in the Unity editor (i.e. #if UNITY_EDITOR). On scene load I then manually call update on each spline a single time to initialize them which allows the SplineController to navigate the spline network.
If the Curvy authors are reading this, It would be nice with official support for this last step of eliminating the update calls for static splines, to avoid having to implement the workaround whenever the package is updated
Best regards
Christian