08-22-2020, 02:40 PM
Hi,
CurvySpline.IsInitialized is set to true at OnEnable and Start. When instantiating via prefab, one of those two methods is not called, or even both of them, I don't remember*. If you don't bother doing tests or looking on internet, the best is to call them both, OnEnable then Start, before using the spline. "Overcalling" those methods should not create any issue.
*The script initialization process in Unity is a hell. It's different depending on Unity's version, on whether you instantiated via editor or script, via prefab or not, on whether it is an editor script or a runtime script, ... Each time I learn it for the sake of debugging or implementing a feature, I forget about it soon after. And of course, the official Unity documentation is incomplete.
CurvySpline.IsInitialized is set to true at OnEnable and Start. When instantiating via prefab, one of those two methods is not called, or even both of them, I don't remember*. If you don't bother doing tests or looking on internet, the best is to call them both, OnEnable then Start, before using the spline. "Overcalling" those methods should not create any issue.
*The script initialization process in Unity is a hell. It's different depending on Unity's version, on whether you instantiated via editor or script, via prefab or not, on whether it is an editor script or a runtime script, ... Each time I learn it for the sake of debugging or implementing a feature, I forget about it soon after. And of course, the official Unity documentation is incomplete.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.