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
  I have a question about curvySpline haifeng.huang 12 32 07-14-2023, 09:34 AM
Last Post: _Aka_
  "Deadloop in CurvySPline.Refresh" spam Valkymaera 3 11 05-30-2023, 10:56 AM
Last Post: _Aka_
  Calling Update with defined deltatime Marco Schultz 3 8 01-25-2023, 01:58 PM
Last Post: _Aka_
  I want SetLocalPositions to update all CPs at once. yanke 3 7 05-30-2022, 02:50 PM
Last Post: _Aka_

Forum Jump: