09-15-2021, 07:15 PM
(This post was last modified: 09-15-2021, 07:27 PM by topquarkone.)
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
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.
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.