Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CurvySpline.Update() sorta expensive
#5
(04-21-2016, 09:49 PM)invadererik Wrote: I have a lot of splines, I don't ever move them, they are static. Why do they need to Update ? 

Can there be a "No Update" mode ? I tried adding one, but then querying spline info does not 
seem to work anymore.

I've added : 
            if (m_UpdateIn == CurvyUpdateMethod.NoUpdate)
                doUpdate();


to the OnEnable call for CurvySpline.cs :  

that seems to make it work, although would be better if it didn't have to refresh the spline OnEnable, just use the data from Editor, I'm going to keep on modding it. Is there a better way to just generate the spline and never update ?


OK I think this does it: 

moved the code all the way to the top of the OnEnable() function:

            if (m_UpdateIn == CurvyUpdateMethod.NoUpdate)
            {
                mIsInitialized = true;
                doUpdate();
                return;
            }


This effectively makes the splines almost zero cost all the time. Not sure what effect it might have in the Editor, but
you can switch it back to Update when editing the splines and switch it back to NoUpdate once you are done. 

Anyway I suggest this small change, should be added to next version !  Big Grin

Hey - many thanks for this.  Made the change so see if I get any side effects  Cool

It might be useful for me when instantiating objects with splines from a pooling solution Smile

cheers

Nalin
Reply


Messages In This Thread
RE: CurvySpline.Update() sorta expensive - by puzzlekings - 04-28-2016, 08:16 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Update and Black Friday sale _Aka_ 2 1,818 11-23-2024, 11:58 AM
Last Post: _Aka_
  Destroying curvyspline instances jmh1804 5 3,016 09-18-2024, 07:52 AM
Last Post: _Aka_
  CurvySpline Optimize Candy 1 1,458 08-02-2024, 08:35 AM
Last Post: _Aka_
  I have a question about curvySpline haifeng.huang 12 7,096 07-14-2023, 09:34 AM
Last Post: _Aka_

Forum Jump: