Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Runtime Optimization
Hello Smile

I'm trying to optimize Curvy as much as possible so it runs well also on lower-end platforms. I've been looking at the profiler and found some Curvy related updates:


All together they take around 2ms on my target platform.

I don't need to update anything at runtime (except moving PathControllers). The splines don't change. Generators don't change, don't need to regenerate.

I was wondering what I could do to reduce the footprint of Curvy as much as possible for this.

What I did so far:
- I turned off Auto Refresh for all Generators.
- I have the output of Generators as Static

Can I set a Spline to not update at Runtime? Is just disabling the component an acceptable way to do that?

Any tips would be very appreciated Smile

Thank you
In the 4 methods you listed, only CurvySpline.Update and CurvySplineSegment.Update are parts of Curvy Splines. Never heard of the other methods. So I will answer only regarding those two methods:

1- Splines do some checks every frames in their update method. You can disable the most costly checks by setting the "Check Transform" value in the inspector to false. The cpu cost of the remaining of the code is insignificant. 'You can't right now make the spline update method do absolutely nothing.
2- How many splines do you have in your scene? The mere existence of an Update method make Unity call it, and if you have thousands of splines (or other game objects with an Update method), just calling those methods, even if they are empty, will cost a little bit of CPU.
3-Are you profiling inside the editor or profiling the build?
4-In general, you can find useful performance tips here:

If by profiling the build, counting only the methods from Curvy Splines and disabling "Check Transform", you still find that the per frame cost of Curvy Splines is high, then please say so in this thread and we will together dive deeper in this subject.

Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Assigning "OnControlPointReached" and "OnEndReached" values during runtime? TenaciousLibbs 2 2,030 02-18-2021, 01:12 PM
Last Post: PretzelStudios
  Subdivide in runtime? Spectra 3 452 10-07-2020, 08:28 AM
Last Post: p30better
  Frequent runtime updates of Curvy Generator for simulating plant growth using Splines h4ck3rd4wg 6 845 10-02-2020, 07:57 PM
Last Post: _Aka_
  Making long roadmesh runtime migeg 19 2,885 08-17-2020, 11:04 PM
Last Post: migeg

Forum Jump: