Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Fixed]CurvySpline.Length can return 0 during init stage
#1
Hello.

Sometimes CurvySpline.Length returns 0.
My setup is - scene loaded and gameObjects with CurvySpline acquired from pool in this new scene. Some of these splines return Length = 0.
Later gameObjects get repooled and also sometimes return Length=0.

I thought it could be due to execution order, but Curvy already set highest order for CurvySpline.
Currently got it hack fixed by making `CurvySpline.Initialize` public, adding `if (mIsInitialized) return;` guard into `Initialize`, and calling `Initialize` before `CurvySpline.Length`

Please help fixing it correctly, thanks.
Reply
#2
Hi,
Length's value is computed based on the positions of the control points. This computation is done via the Refresh method, which is public. This is done automatically at initialization, and each frame when needed. Sometimes, when using the API, one can modify something that would need a manual Refesh call if one does not want to wait for the automatic call next frame.
Can you please tell when you create the spline and when you call the Length property. If you can provide me code it would be even better.
Also, can you confirm to me that calling Refresh fixes the issue?
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.
Reply
#3
Hello,
Calling CurvySpline.Refresh before CurvySpline.Length fixed it. Thanks.

Here is more info in case still needed.
The spline was inside prefab referenced by scene pool, during one function:
- instance got created by pool, taken from it
- CurvySpline.Length was used to put objects evenly along the spline
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  CurvySpline Editor event ATHellboy 1 739 03-08-2020, 01:51 PM
Last Post: _Aka_
  Duplicate CurvySpline pysnoo 1 1,218 07-01-2019, 04:55 PM
Last Post: _Aka_
  Disable the Update of the CurvySpline UsernameHed 8 3,551 05-29-2019, 01:13 PM
Last Post: _Aka_
  Freewalk mode, then return to spline mythstified 6 7,337 11-09-2018, 08:20 AM
Last Post: sanaeerumey

Forum Jump: