Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Best practice when Instantiating game object with spline
#2
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.
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply


Messages In This Thread
RE: Best practice when Instantiating game object with spline - by _Aka_ - 08-22-2020, 02:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Best way to duplicate a spline with an offset Kapistijn 7 646 02-07-2026, 07:59 PM
Last Post: _Aka_
Smile Constant speed along a spline? tfishell 1 495 11-13-2025, 11:32 AM
Last Post: _Aka_
  Create Game Object Renaming Options rickgplus 1 786 09-23-2025, 09:33 AM
Last Post: _Aka_
  SplineController Ignores Follow-Up and Chooses Wrong Spline Josenildo 7 4,062 07-29-2025, 09:15 PM
Last Post: _Aka_

Forum Jump: