Using UCurveFloat returns 0 after 60 seconds

Hi,
I just wanted to check if I’m using FCurveFloat in the right way.

I’m trying to use an UCurveFloat as a simple mathmatical lookup/interpolation data structure. All seems to work OK for about 60 seconds but then starts returning 0 or weird values.

I’m NOT using it for animation or anything timeline related, just stealing the nice interpolation functionality.

As a test I’ve stripped out most of the surrounding functionality and just left the basic structure.
defined in the object’s public: variables

UCurveFloat *myCurve;

Initialised with some simple static values:

myCurve = NewObject<UCurveFloat>();
myCurve->FloatCurve.AddKey(0, 0.0 );
myCurve->FloatCurve.AddKey(10, 100 );
myCurve->FloatCurve.AddKey(20, 100 );
myCurve->FloatCurve.AddKey(30 , 0.0 );

and then read back in the main code loop ( via the parent Pawn’s tick ) :


float inputval = 5;
float outputfactor = myCurve->GetFloatValue( inputval );
UE_LOG(LogVikingVehicle, Display, TEXT("curve test: %f = %f"), inputval ,outputfactor  );

With this static input, the output value is correct and constant for 60 seconds and then I get 0 or occasional random large values out.

IsValid(myCurve) still return true.

I’m happy that the variable is still in scope in c++ terms, but wondered if there is additional functionality in the UCurveFloat that is related to timelines,etc.

Thanks.