10-25-2015, 08:21 AM
The only difference to the editor is that in the editor the curve refreshes at more occasions (i.e. ControlPoints use Update() in the editor, but not automatically at runtime for performance reasons). When dynamically working with curves at runtime, there are a few basic rules:
* If you work with an existing spline at startup, be sure to check/wait for initialization ("while (!spline.IsInitialized) yield 0" in Start())
* If you change any spline parameters or add/remove Control Points, the spline is updated either in it's next call to Update() (next frame usually) or if you call spline.Refresh() manually
* If you change the position if Control Points, the spline needs to know about this. Three options:
- use API to move the CP (CurvySplineSegment.localPosition etc...)
- enable "Check Transforms" at the spline to automatically detect changed CP transforms
- call CurvySplineSegment.SetDirty() manually
For the latter case, note that calling Refresh() only doesn't help because it only recalculates changed stuff, so you need to call SetDirty() before to make the spline know about changes.
If that doesn't help, please post your generation code.
* If you work with an existing spline at startup, be sure to check/wait for initialization ("while (!spline.IsInitialized) yield 0" in Start())
* If you change any spline parameters or add/remove Control Points, the spline is updated either in it's next call to Update() (next frame usually) or if you call spline.Refresh() manually
* If you change the position if Control Points, the spline needs to know about this. Three options:
- use API to move the CP (CurvySplineSegment.localPosition etc...)
- enable "Check Transforms" at the spline to automatically detect changed CP transforms
- call CurvySplineSegment.SetDirty() manually
For the latter case, note that calling Refresh() only doesn't help because it only recalculates changed stuff, so you need to call SetDirty() before to make the spline know about changes.
If that doesn't help, please post your generation code.