Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OnControlPointReached not triggering when metadata attached
#1
Hello there,

In my game i make use of OnControlPointReached.AddListenerOnce().
The problem i run into is, that every once in a while (maybe 1 out of 200 runs) the Listener will not fire for control points where there is a Metadata script attached to it.
It works fine most of the time, and i have no clue what could cause it not to fire in these rare occasions.
Any ideas? The code looks something like this:


       protected override void Start(){
           if(Application.isPlaying){
               OnControlPointReached
.AddListenerOnce(OnCPReached);

           base.Start();
       }

   
       public void OnCPReached(CurvySplineMoveEventArgs e)
       {
           if(Application.isPlaying){
               Debug.Log(e.ControlPoint.ToString());

               var metadata = e.ControlPoint.GetMetadata<FinishMetadata>();              
               if(metadata!=null){
                   Debug.Log("has metadata attached");
               }
           }
       }

So on a good run the Console output will look something like:
Spline.CP0002
Spline.CP0003
Spline.CP0004
Spline.CP0005
has metadata attached
Spline.CP0006

on a bad run:
Spline.CP0002
Spline.CP0003
Spline.CP0004
Spline.CP0006

CP0005 is just missing and not "listening" at all ....
Reply
#2
That's weird. And it happens only for CPs with meta data I guess, right? Can you tell me what Curvy version you use? And also can you send me a reproduction case?
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
Yes, only happens for CPs with meta data. Curvy version is 5.2.1 and Unity version is 2018.2.10f1
For the time being i made a workaround, i will send you a reproduction case once i got a bit of time on my hands.
The reproduction case would ideally be just a Bezier Spline containing some CPs with metadata attached and a SplineController with the OnCPReached listener.
Reply
#4
I tried to reproduce but couldn't, even with thousounds trigerred events. I looked at the code, and I don't see anything obvious that would make the event logic depend on the existence or not of metadata. I attached the scene that I used to test it. Let me know if my test scene do reproduce the bug on your setup


Attached Files
.zip   EventMetaData.zip (Size: 5.15 KB / Downloads: 2)
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
  "MetaData" Of Entire Spline Heightmap SAMYTHEBIGJUICY 3 6 10-16-2023, 08:42 AM
Last Post: _Aka_
  Metadata interpolation tairoark 3 10 10-17-2022, 01:07 PM
Last Post: _Aka_
  Proper metadata usage tairoark 2 8 10-01-2022, 12:04 PM
Last Post: _Aka_
  Accessing Metadata from CG hucota7 1 8 02-16-2022, 08:49 PM
Last Post: _Aka_

Forum Jump: