Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OnAfterControlPointAdded - Control Point is null
#1
Hi there,

I've hooked up a spline OnAfterControlPointAdded event, it fires correctly each time but the args ControlPoint value is always null.

Is this something you could confirm is a bug, or if it's on my side?

Many thanks

John
Reply
#2
Hi,
I tried to reproduce the issue but couldn't. Can you please send me a reproduction case?
Attached is my reproduction attempt.
Have a nice day.


Attached Files
.unitypackage   event test.unitypackage (Size: 3.3 KB / Downloads: 1)
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#3
Hi and thank you for the very fast reply and code sample.

I will try and get something for you, but in my code I am creating the spline dynamically and adding the control points dynamically. As soon as the spline is created I add a listener like so:

Code:
spline.OnAfterControlPointAdd.AddListener(OnAfterControlPointAdd);

Here is a live inspection at runtime of the args, ControlPoint is null every time.

[Image: 29st6w3h]

Thank you for looking, this is not a high priority.

John
Reply
#4
Do you create your spline via Unity's API or CurvySpline.Create()?

Try calling yourSpline.Start() just after creating your spline.
This method initializes the spline. It is called automatically by Unity at the first frame after the creation of a spline. You need to call it manually if you instantiate a CurvySpline via Unity API (in opposition to calling CurvySpline.Create()), and need to use it the same frame before Unity calls Start() on it the next frame.
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#5
Thank you for your help, calling Start seems to have done the trick.
Reply
#6
You are welcome.
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
  Null Reference Exception rickgplus 1 102 03-01-2025, 02:09 PM
Last Post: _Aka_
  How to generate gameobject on the control point Yang Yi 1 115 12-10-2024, 10:14 PM
Last Post: _Aka_
  Duplicate Volume references become null joebain 5 274 11-18-2024, 10:46 AM
Last Post: joebain
  Getting Distance from a World Point zorksox 3 175 04-16-2024, 07:30 PM
Last Post: _Aka_

Forum Jump: