Replays: SetMaxDesiredRecordTimeMS

SetMaxDesiredRecordTimeMS from epic documentation:

this is from UDemoNetDriver

thing is DemoNetDriver only exists if there is some replay action happenning (recording, playing…)
if the game is not recording or playing, DemoNetDriver doesnt exists ( GetWorld()->GetDemoNetDriver() is nullptr )

I suppose that parameter sets the max time you want to record the replay and if recording exceeds that time will start flushing the older recording material to keep total recording time = that param.

Just tried to create a UnetDemoNetDriver variable and set that parameter but is not working.

How is the proper way of doing it?

this is what I tried:

UDemoNetDriver* mydriver = NewObject<UDemoNetDriver>(this);
	mydriver->SetMaxDesiredRecordTimeMS(3000.f);
	StartRecordingReplay(recordingName,recordingFriendlyName);

if I do this:

GetWorld()->GetDemoNetDriver()->SetMaxDesiredRecordTimeMS(3000.f);
StartRecordingReplay(recordingName,recordingFriendlyName);

first line will get null and crash.