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: 0)
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
Question Control Point Metadata gets cleared. DavidH 2 47 12-09-2019, 03:04 PM
Last Post: DavidH
Information Upcoming changes to the Metadata API _Aka_ 0 233 07-23-2019, 04:14 PM
Last Post: _Aka_
  Assigning "OnControlPointReached" and "OnEndReached" values during runtime? TenaciousLibbs 1 734 03-06-2019, 11:02 AM
Last Post: _Aka_
  Move spline attached to gameobject. Juwdah 6 4,942 06-07-2018, 06:01 PM
Last Post: _Aka_

Forum Jump: