Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems with spline prefab
#1
Hi,

I created a simple spline (in editor), and wrote some scripts to access it. They worked fine. I then copied that spline into assets, as a prefab.

I wrote code to instantiate the prefab, which it did! However, while it looks fine in the Editor, the script says it has Length=0, and I get a Curvy exception when I try TFToDistance or Interpolate.

Any help would be appreciated!

Thanks.

PS - 

I just tried it again. I am doing this all in Edit mode.
I am instantiating the spline in the script using 
Code:
CurvySpline mySpline = PrefabUtility.InstantiatePrefab(splinePrefab) as CurvySpline;

This *does* instantiate the spline. When I check mySpline in the code right after, and while it is indeed a spline (has the correct number of control points), it does not work as said above. If I exit the code, and come back and check it in the code, it is fine.
Reply
#2
Hi
Try calling mySpline.Start() after instantiating the prefab. Did that fix the problem?
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
I think that did the trick! I'll let you know if it doesn't...

Thanks for your help.
Reply
#4
You are welcome. I'm here if you need something else.
If and when you feel like it, please leave a review for the asset, that helps a lot
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


Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
  GO can't fit end of the spline GameDeveloperek4123 3 14 03-04-2024, 11:06 AM
Last Post: _Aka_

Forum Jump: