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


Messages In This Thread
Problems with spline prefab - by topquarkone - 09-15-2021, 07:15 PM
RE: Problems with spline prefab - by _Aka_ - 09-15-2021, 08:12 PM
RE: Problems with spline prefab - by topquarkone - 09-15-2021, 08:32 PM
RE: Problems with spline prefab - by _Aka_ - 09-15-2021, 08:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Filling a closed spline dynamically rickgplus 1 244 04-16-2025, 08:56 AM
Last Post: _Aka_
  Disable a spline's gizmo when not selected or disabled. mikechr2000 1 297 02-03-2025, 09:34 AM
Last Post: _Aka_
  Duplicate Prefab along path rickgplus 1 349 01-23-2025, 10:09 AM
Last Post: _Aka_
Information Questions regarding spline colliders and collisions with rigidbodies Spyboticer 7 1,134 01-20-2025, 12:25 PM
Last Post: _Aka_

Forum Jump: