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 ....
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 ....