Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
spline controller is frustrating
#1
I just want to assign a spline and make it play. Why is it so complicated to make it work?

Code:
splineController.Spline = myspline;
splineController.Refresh();
splineController.Position = 0;
splineController.Speed = 1;
while (!splineController.IsInitialized)
{
yield return null;
}
splineController.Play();

NOTHING HAPPENS

how is it done?
www.hawkenking.com - interactive design & game development
Reply
#2
Hi,
I suppose the provided code lays within a Start method. Based on this supposition, your issue happens because your code is executed before the Start() method of the controller.
To avoid the issue, make sure your code is executed after the Controller's start. You can use the Unity's script execution order for this effect.
Another way to avoid the issue is to use splineController.PlayAutomatically = true; to make the controller play whenever he is ready.

Also, your code can be simplified:
Code:
splineController.Spline = myspline;
splineController.Position = 0;
splineController.Speed = 1;
splineController.Play();

As of Curvy 2.2.3, both controllers and splines did have issues with initialization order, which is the cause the bug you encountered. Curvy 2.2.4 was planned to include a code rework of the controllers and splines to fix this issue, other issues, and reduce CPU and memory usage. That work ended up being long enough to be divided into two releases:
  • 2.2.4 : Curvy Spline and Curvy Spline Segments (and few fixes for controllers)
  • 2.2.5 (which I am working on right now) : Spline Controller and other controllers.
Sorry for the inconvenience, and please let me know if you still encounter the issue. If so, please provide me the Curvy version you are using, and a description of where and when the posted code is called.

Thank you and have a nice day.
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Disable a spline's gizmo when not selected or disabled. mikechr2000 1 97 02-03-2025, 09:34 AM
Last Post: _Aka_
Information Questions regarding spline colliders and collisions with rigidbodies Spyboticer 7 354 01-20-2025, 12:25 PM
Last Post: _Aka_
  Extrude mesh along spline. New and confused user GhostStalker 3 122 01-02-2025, 09:58 AM
Last Post: _Aka_
  Newly created spline is invisible quickytools 7 225 12-21-2024, 10:14 AM
Last Post: _Aka_

Forum Jump: